[Gnucash-changes] Duplicate Transaction dialog fixes.
Joshua Sled
jsled at cvs.gnucash.org
Sat Oct 8 15:52:36 EDT 2005
Log Message:
-----------
Duplicate Transaction dialog fixes.
2005-10-08 Joshua Sled <jsled at asynchronous.org>
* src/register/ledger-core/dialog-dup-trans.c
(gnc_dup_trans_dialog): Cleanup the window after dialog returns.
(gnc_dup_trans_dialog_create): attach to existing signals; re-implement
spinbutton behavior workaround.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash:
ChangeLog
GNOME2_STATUS
gnucash/src/register/ledger-core:
dialog-dup-trans.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.318
retrieving revision 1.1487.2.319
diff -LChangeLog -LChangeLog -u -r1.1487.2.318 -r1.1487.2.319
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,12 @@
2005-10-08 Joshua Sled <jsled at asynchronous.org>
+ * src/register/ledger-core/dialog-dup-trans.c
+ (gnc_dup_trans_dialog): Cleanup the window after dialog returns.
+ (gnc_dup_trans_dialog_create): attach to existing signals; re-implement
+ spinbutton behavior workaround.
+
+2005-10-08 Joshua Sled <jsled at asynchronous.org>
+
* goffice.c (libgoffice_init): fully initialize so plugins get
loaded at init-time, and thus displayed at run-time. :p
Other goffice/html/graphing code cleanups.
Index: GNOME2_STATUS
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/Attic/GNOME2_STATUS,v
retrieving revision 1.1.2.73
retrieving revision 1.1.2.74
diff -LGNOME2_STATUS -LGNOME2_STATUS -u -r1.1.2.73 -r1.1.2.74
--- GNOME2_STATUS
+++ GNOME2_STATUS
@@ -126,7 +126,7 @@
- doesn't remember custom check formats.
- - duplicate-transaction dialog cannot be Ok- or Cancel-ed.
+ - duplicate-transaction dialog is not initialized with transaction number
- Reconcile
Index: dialog-dup-trans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/register/ledger-core/dialog-dup-trans.c,v
retrieving revision 1.1.6.3
retrieving revision 1.1.6.4
diff -Lsrc/register/ledger-core/dialog-dup-trans.c -Lsrc/register/ledger-core/dialog-dup-trans.c -u -r1.1.6.3 -r1.1.6.4
--- src/register/ledger-core/dialog-dup-trans.c
+++ src/register/ledger-core/dialog-dup-trans.c
@@ -72,54 +72,18 @@
return TRUE;
}
-/*
- * This code works around an annoying bug in the SpinButton -- as soon
- * as you focus into the spin button it wants to force a digit to
- * appear and there is nothing the user can do. Once you focus in,
- * the user cannot make the spin button entry be empty.
- *
- * To make matters worse, the spin button draws this number AFTER a
- * focus-out event, so we can't just use that event to clear it out.
- *
- * To work around this problem we hook into two signals, focus-out and
- * draw. The focus-out event lets us know when we leave the
- * spinbutton entry, and we set a flag to remember this fact, and also
- * queue a redraw (just to be sure). The draw event happens more
- * frequently, but also happens after the spin button digitizes
- * itself. So when we hit a draw event we can check the flag and if
- * it's set we can potentially empty out the entry.
- *
- * This also means you cannot have a check numbered "0", but that is
- * probably a reasonable limitation.
- */
-static void
-gnc_dup_trans_focus_out_cb (GtkSpinButton *button, GdkEventFocus *event,
- gpointer user_data)
+static gboolean
+gnc_dup_trans_output_cb(GtkSpinButton *spinbutton,
+ gpointer user_data)
{
- DupTransDialog *dt_dialog = user_data;
-
- g_return_if_fail(GTK_IS_SPIN_BUTTON(button));
- if (!dt_dialog) return;
-
- dt_dialog->focus_out = TRUE;
- gtk_widget_queue_draw(GTK_WIDGET(button));
-}
-
-static void
-gnc_dup_trans_draw_cb (GtkSpinButton *button, GdkRectangle *unused, gpointer data)
-{
- DupTransDialog *dt_dialog = data;
-
- g_return_if_fail(GTK_IS_SPIN_BUTTON(button));
- if (!dt_dialog) return;
-
- if (!dt_dialog->focus_out)
- return;
-
- dt_dialog->focus_out = FALSE;
-
- if (!gtk_spin_button_get_value_as_int(button))
- gtk_entry_set_text(GTK_ENTRY(button), "");
+ gboolean is_number;
+ long int num;
+ gchar *txt = gtk_editable_get_chars(GTK_EDITABLE(spinbutton), 0, -1);
+ is_number = parse_num(txt, &num);
+ g_free(txt);
+ if (!is_number)
+ gtk_entry_set_text(GTK_ENTRY(spinbutton), "");
+ return !is_number;
}
static void
@@ -161,10 +125,8 @@
num_spin = glade_xml_get_widget (xml, "num_spin");
dt_dialog->num_edit = num_spin;
- gtk_signal_connect (GTK_OBJECT(num_spin), "focus-out-event",
- GTK_SIGNAL_FUNC(gnc_dup_trans_focus_out_cb), dt_dialog);
- gtk_signal_connect (GTK_OBJECT(num_spin), "draw",
- GTK_SIGNAL_FUNC(gnc_dup_trans_draw_cb), dt_dialog);
+ gtk_signal_connect(GTK_OBJECT(num_spin), "output",
+ GTK_SIGNAL_FUNC(gnc_dup_trans_output_cb), dt_dialog);
if (num_str && parse_num (num_str, &num))
gtk_spin_button_set_value (GTK_SPIN_BUTTON (num_spin), num + 1);
@@ -217,6 +179,7 @@
else
ok = FALSE;
+ gtk_widget_destroy(GTK_WIDGET(dt_dialog->dialog));
g_free (dt_dialog);
return ok;
More information about the gnucash-changes
mailing list