Re: Gtk2::FileChooser - hour and minute stats




On Feb 12, 2006, at 8:22 AM, zentara wrote:

I saw this question on the newsgroups today, and it made me think about this shortcoming in the FileChooser.

It only shows the day of last modification, which makes it tricky to file files all made on the same day.

So is there a gtkrc setting, or some widget setting to add extended times to the FileChooser?

Or would we have to make a custom widget to display the extra file time info?

It looks that way. The modification time column of the file list view in GtkFileChooserDefault uses a cell data function to fetch and format the modification time, and this function (gtkfilechooserdefault.c:7041:list_mtime_data_func), it specially coded to say "Today" or "Yesterday", or to ask g_date_strftime() to use "%A" for days within the last week, and "%x" for anything else. These strings are all localized, and there is no logic for alternative formats.

It is feasible for you to create and use your own widget that implements the FileChooser interface, but this is a nontrivial task and would make your application inconsistent with the rest of your desktop. Then again, you could patch your local copy of gtk+ to use strftime("%F %T",...) instead of all that fancy logic, and then you'd have this behavior in all of your apps. Or, make the patch choose which format to use based on a setting and submit the patch to the gtk + maintainers.


If you just want to be *able* to find the mod time in the file chooser, without needing to see all of them at a glance, and just in your one app, you can set up an "extra" widget and update its contents with the modification time when a new file is selected. The example "file_chooser.pl" that comes with Gtk2 will get you started.


I know that mozilla (gtk based ) will display a more informative time string.

Careful...  that depends on many factors.

The Mozilla i have here is the stock FC2 Mozilla. It uses the "native" file selection dialogs, and therefore uses a stock Gnome GtkFileChooser. The "Modified" column shows "Today", "Yesterday", "Friday", and MM/DD/YYYY dates.

However, i installed Firefox into /usr/local from mozilla.org -- *not* Fedora packages, and thus not using native dialogs. The file selection widget in here is a XUL-implemented thing that i have seen on Mozilla since they started using XUL; vaguely reminiscent of Win98's file selection dialog in "details" mode. This one shows three columns -- "Name", "Size", and "Last Modified", which has the DD/MM/YY hh:mm:ss, and even offers which columns to hide.


It's interesting to note that gtkfilechooserdefault.c contains code to create a "Size" column in the browse view, but it is "#if 0"'d out.

--
Brian: If i recall correctly, this is the physics department.
Chris: That explains all that gravity.
    -- Family Guy, "The Story on Page One"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]