Bug 230186

Summary: GnomeDateEdit problems
Product: [Fedora] Fedora Reporter: Zoltan Boszormenyi <zboszor>
Component: gnome-libsAssignee: Paul Howarth <paul>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.4.2-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-11 11:41:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test case for datetime problem
none
GNOME 2 testcase
none
Fixes for GnomeDateEdit
none
GnomeDateEdit final fix none

Description Zoltan Boszormenyi 2007-02-27 10:15:51 UTC
Description of problem:

In GNOME-1.x applications recompiled for FC6, I observed some problems
with GnomeDateEdit widgets.

1. The time entry contains bogus time separator, a "." instead
of a ":". As a consequence, certain buggy behaviour is observed.
- Setting the date first (either from the dropdown calendar or manually)
  and then the time from the dropdown menu modifies the previously set
  date string.
- Using gnome_date_edit_get_date() on the widget gives bad
  time_t value, e.g. the bad separator stops interpreting
  the time string. Altering the time string manually so
  it reads correctly with ":" separators, make this problem
  go away.

2. Clearing both the date and time entries and then using
gnome_date_edit_get_date() gives back the current date (+ 0:00:00)
instead of (time_t)-1. It worked on earlier systems, Red Hat 6.x,
Red Hat 7.x, RH9 and up to FC5 were tested.

Version-Release number of selected component (if applicable):

$ rpm -q gnome-libs
gnome-libs-1.4.2-3.fc6

How reproducible:

Always.

Steps to Reproduce:
1. Compile and the attached test case (created with glade-0.6.4) on FC6 with
   gnome-libs-1.x installed.
2. Run it.
3.
  
Actual results:

Described above.

Expected results:

The time string should contain ":" time separator both
in the dropdown menu and in the time entry of the GnomeDateEdit.

Additional info:

Comment 1 Zoltan Boszormenyi 2007-02-27 10:15:51 UTC
Created attachment 148851 [details]
Test case for datetime problem

Comment 2 Zoltan Boszormenyi 2007-02-27 10:47:51 UTC
Created attachment 148853 [details]
GNOME 2 testcase

The attached GNOME 2 testcase works as expected from my description,
e.g. empty date entry gives (time_t)-1 which translates to 1899-12-31
0:00:00.

I also discovered that the command line "date" gives the time separated
also with dots. The GNOME 2 test case work despite of this. The GNOME 1.x
bug may be a bad interaction between the tzdata(?) or the info set by LANG.
It is hu_HU.UTF-8 in my case, BTW.

Comment 3 Paul Howarth 2007-02-27 11:11:25 UTC
Given that upstream isn't going to fix this, it's going to be down to you and me
to either find a fix for this (e.g. from another distro) or write one ourselves...

Comment 4 Zoltan Boszormenyi 2007-02-27 12:08:36 UTC
Created attachment 148858 [details]
Fixes for GnomeDateEdit

I came up with the attached patch that fixes the problems
I described earlier.
- invalid date entry now returns (time_t)-1
- the time dropdown contains the same entries as GnomeDateEdit on GNOME 2,
  i.e. hardcoded %H:%M. The selected time string was always copied to 
  the time entry, which (having an incorrect format) caused problems.
- the time entry contains %H:%M:%S after doing gnome_date_edit_set_time()
  and on initial gtk_widget_show()

Comment 5 Zoltan Boszormenyi 2007-02-27 12:14:56 UTC
The fix may be a bit simpler, though. Option "%X" in strftime() calls
can simply be substituted with "%R" and "%T" where appropriate.
Just checked with these commands:
$ date "+%X"
13.13.58
$ date "+%T"
13:14:01
$ date "+%R"
13:14

Comment 6 Zoltan Boszormenyi 2007-02-27 12:28:09 UTC
Created attachment 148859 [details]
GnomeDateEdit final fix

This fix implements the modified strftime() options,
works as good as the hardcoded sprintf().

Comment 7 Paul Howarth 2007-03-11 11:41:43 UTC
gnome-libs-1.4.2-5 contains your patch from Comment #6 and has been released for
FC-6 and Rawhide.