mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Eliminate a critical warning message in the gnc_date widget (#106675)
and make the accelerator keys work properly when the calender part is visible. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8086 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
2003-03-15 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/gnc-date-edit.c: Fix the keypress handlers so
|
||||
they work properly for both the text entry widget and the calendar
|
||||
popup widget.
|
||||
|
||||
* src/gnome-utils/dialog-utils.c (gnc_handle_date_accelerator):
|
||||
Eliminate a critical warning message. #106675
|
||||
|
||||
* src/register/ledger-core/split-register.c
|
||||
(gnc_split_register_config): Force the cursor to the first line of
|
||||
a transaction split before disabling "double line" mode in the
|
||||
|
||||
@@ -658,7 +658,7 @@ gnc_handle_date_accelerator (GdkEventKey *event,
|
||||
if (event->type != GDK_KEY_PRESS)
|
||||
return FALSE;
|
||||
|
||||
if ((tm->tm_mday == -1) || (tm->tm_mon == -1) || (tm->tm_year == -1))
|
||||
if ((tm->tm_mday <= 0) || (tm->tm_mon == -1) || (tm->tm_year == -1))
|
||||
return FALSE;
|
||||
|
||||
g_date_set_dmy (&gdate,
|
||||
|
||||
@@ -169,12 +169,11 @@ delete_popup (GtkWidget *widget, gpointer data)
|
||||
static gint
|
||||
key_press_popup (GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
{
|
||||
GNCDateEdit *gde;
|
||||
GNCDateEdit *gde = data;
|
||||
|
||||
if (event->keyval != GDK_Escape)
|
||||
return date_accel_key_press(widget, event, data);
|
||||
return date_accel_key_press(gde->date_entry, event, data);
|
||||
|
||||
gde = data;
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
|
||||
hide_popup (gde);
|
||||
|
||||
@@ -567,11 +566,19 @@ date_accel_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
1900 + tm.tm_year);
|
||||
gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), tm.tm_mday);
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
key_press_entry (GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
{
|
||||
if (!date_accel_key_press(widget, event, data))
|
||||
return FALSE;
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
date_focus_out_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
{
|
||||
@@ -603,7 +610,7 @@ create_children (GNCDateEdit *gde)
|
||||
gtk_box_pack_start (GTK_BOX (gde), gde->date_entry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (gde->date_entry);
|
||||
gtk_signal_connect (GTK_OBJECT (gde->date_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC(date_accel_key_press), gde);
|
||||
GTK_SIGNAL_FUNC(key_press_entry), gde);
|
||||
gtk_signal_connect (GTK_OBJECT (gde->date_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC(date_focus_out_event), gde);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user