glom r1734 - in trunk: . glom
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1734 - in trunk: . glom
- Date: Fri, 21 Nov 2008 16:28:24 +0000 (UTC)
Author: murrayc
Date: Fri Nov 21 16:28:23 2008
New Revision: 1734
URL: http://svn.gnome.org/viewvc/glom?rev=1734&view=rev
Log:
2008-11-21 Murray Cumming <murrayc murrayc com>
* glom/glom.glade: dialog_import_csv: Added a lable for advice about
the expected data format.
* glom/dialog_import_csv.cc: Constructor: Generate advice text in the
label, showing an example of the expected ISO date format.
Ubuntu bug https://bugs.launchpad.net/ubuntu/+source/glom/+bug/299591
Modified:
trunk/ChangeLog
trunk/glom/dialog_import_csv.cc
trunk/glom/dialog_import_csv.h
trunk/glom/glom.glade
Modified: trunk/glom/dialog_import_csv.cc
==============================================================================
--- trunk/glom/dialog_import_csv.cc (original)
+++ trunk/glom/dialog_import_csv.cc Fri Nov 21 16:28:23 2008
@@ -240,6 +240,7 @@
refGlade->get_widget("import_csv_encoding_info", m_encoding_info);
refGlade->get_widget("import_csv_first_line_as_title", m_first_line_as_title);
refGlade->get_widget("import_csv_sample_rows", m_sample_rows);
+ refGlade->get_widget("import_csv_advice_label", m_advice_label);
refGlade->get_widget("import_csv_error_label", m_error_label);
if(!m_sample_view || !m_encoding_combo || !m_target_table || !m_encoding_info || !m_first_line_as_title || !m_sample_rows || !m_error_label)
throw std::runtime_error("Missing widgets from glade file for Dialog_Import_CSV");
@@ -274,6 +275,24 @@
m_sample_view->set_headers_visible(m_first_line_as_title->get_active());
+
+ //Warn the user about the numeric and date formats expected:
+
+ //A date that is really really the date that we mean:
+ tm the_c_time;
+ memset(&the_c_time, 0, sizeof(the_c_time));
+
+ //We mean 22nd November 2008:
+ the_c_time.tm_year = 2008 - 1900; //C years start are the AD year - 1900. So, 01 is 1901.
+ the_c_time.tm_mon = 11 - 1; //C months start at 0.
+ the_c_time.tm_mday = 22; //starts at 1
+
+ //Get the ISO (not current locale) text representation:
+ const Glib::ustring date_text = Glom::Conversions::format_date(the_c_time, std::locale() /* ignored */, true /* iso_format */);
+ const Glib::ustring advice = Glib::ustring::compose(_("Note that the source file should contain numbers and dates in international ISO format. For instance, 22nd November 2008 should be %1."), date_text);
+ m_advice_label->set_text(advice);
+ std::cout << "DEBUG: advice=" << advice << std::endl;
+
clear();
}
Modified: trunk/glom/dialog_import_csv.h
==============================================================================
--- trunk/glom/dialog_import_csv.h (original)
+++ trunk/glom/dialog_import_csv.h Fri Nov 21 16:28:23 2008
@@ -136,6 +136,7 @@
Gtk::Label* m_encoding_info;
Gtk::CheckButton* m_first_line_as_title;
Gtk::SpinButton* m_sample_rows;
+ Gtk::Label* m_advice_label;
Gtk::Label* m_error_label;
Glib::RefPtr<Gio::File> m_file;
Modified: trunk/glom/glom.glade
==============================================================================
--- trunk/glom/glom.glade (original)
+++ trunk/glom/glom.glade Fri Nov 21 16:28:23 2008
@@ -1539,15 +1539,25 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="import_csv_error_label">
+ <widget class="GtkLabel" id="import_csv_advice_label">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">label</property>
+ <property name="label" translatable="no"></property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="import_csv_error_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="no">label</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]