Hello community, here is the log from the commit of package libyui-gtk for openSUSE:Factory checked in at 2014-05-07 06:55:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyui-gtk (Old) and /work/SRC/openSUSE:Factory/.libyui-gtk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui-gtk" Changes: -------- --- /work/SRC/openSUSE:Factory/libyui-gtk/libyui-gtk.changes 2014-04-05 16:47:36.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libyui-gtk.new/libyui-gtk.changes 2014-05-07 06:55:23.000000000 +0200 @@ -1,0 +2,13 @@ +Tue May 6 09:58:49 UTC 2014 - co...@suse.com + +- don't error out on deprecated gtk widgets +- 2.44.5 + +------------------------------------------------------------------- +Fri Apr 25 15:40:31 CEST 2014 - anase...@linux.it + +- Fixed YGDateField and YGTimeField input validity check +- Fixed YGImage::setImage implementation (gh#libyui/libyui-gtk#44) +- 2.44.4 + +------------------------------------------------------------------- Old: ---- libyui-gtk-2.44.3.tar.bz2 New: ---- libyui-gtk-2.44.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyui-gtk-doc.spec ++++++ --- /var/tmp/diff_new_pack.1v9vHN/_old 2014-05-07 06:55:24.000000000 +0200 +++ /var/tmp/diff_new_pack.1v9vHN/_new 2014-05-07 06:55:24.000000000 +0200 @@ -17,7 +17,7 @@ Name: libyui-gtk-doc -Version: 2.44.3 +Version: 2.44.5 Release: 0 Source: libyui-gtk-%{version}.tar.bz2 ++++++ libyui-gtk.spec ++++++ --- /var/tmp/diff_new_pack.1v9vHN/_old 2014-05-07 06:55:24.000000000 +0200 +++ /var/tmp/diff_new_pack.1v9vHN/_new 2014-05-07 06:55:24.000000000 +0200 @@ -17,7 +17,7 @@ Name: libyui-gtk -Version: 2.44.3 +Version: 2.44.5 Release: 0 Source: libyui-gtk-%{version}.tar.bz2 @@ -81,8 +81,8 @@ %build -export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG" -export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG" +export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG -Wno-error=deprecated-declarations" +export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG -Wno-error=deprecated-declarations" ./bootstrap.sh %{_prefix} ++++++ libyui-gtk-2.44.3.tar.bz2 -> libyui-gtk-2.44.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-gtk-2.44.3/ChangeLog new/libyui-gtk-2.44.5/ChangeLog --- old/libyui-gtk-2.44.3/ChangeLog 2014-04-04 17:39:45.000000000 +0200 +++ new/libyui-gtk-2.44.5/ChangeLog 2014-05-06 12:45:48.000000000 +0200 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Tue May 6 09:58:49 UTC 2014 - co...@suse.com + +- don't error out on deprecated gtk widgets +- 2.44.5 + +------------------------------------------------------------------- +Fri Apr 25 15:40:31 CEST 2014 - anase...@linux.it + +- Fixed YGDateField and YGTimeField input validity check +- Fixed YGImage::setImage implementation (gh#libyui/libyui-gtk#44) +- 2.44.4 + +------------------------------------------------------------------- Thu Mar 20 14:13:03 CET 2014 - anase...@linux.it - Fixed smaller dialog (gh#libyui/libyui-gtk#41) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-gtk-2.44.3/VERSION.cmake new/libyui-gtk-2.44.5/VERSION.cmake --- old/libyui-gtk-2.44.3/VERSION.cmake 2014-04-04 17:39:45.000000000 +0200 +++ new/libyui-gtk-2.44.5/VERSION.cmake 2014-05-06 12:45:48.000000000 +0200 @@ -1,6 +1,6 @@ SET( VERSION_MAJOR "2" ) SET( VERSION_MINOR "44" ) -SET( VERSION_PATCH "3" ) +SET( VERSION_PATCH "5" ) SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SHA1}" ) ##### This is need for the libyui core, ONLY. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-gtk-2.44.3/libyui-gtk.spec.in new/libyui-gtk-2.44.5/libyui-gtk.spec.in --- old/libyui-gtk-2.44.3/libyui-gtk.spec.in 2014-02-24 11:39:44.000000000 +0100 +++ new/libyui-gtk-2.44.5/libyui-gtk.spec.in 2014-05-06 12:45:48.000000000 +0200 @@ -75,8 +75,8 @@ %build -export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG" -export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG" +export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG -Wno-error=deprecated-declarations" +export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG -Wno-error=deprecated-declarations" ./bootstrap.sh %{_prefix} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-gtk-2.44.3/src/YGImage.cc new/libyui-gtk-2.44.5/src/YGImage.cc --- old/libyui-gtk-2.44.3/src/YGImage.cc 2014-02-21 15:08:01.000000000 +0100 +++ new/libyui-gtk-2.44.5/src/YGImage.cc 2014-05-06 11:45:52.000000000 +0200 @@ -25,6 +25,13 @@ : YImage (NULL, filename, animated), YGWidget (this, parent, YGTK_TYPE_IMAGE, NULL) { + setImage( filename, animated ); + } + + virtual void setImage( const std::string & filename, bool animated ) + { + YImage::setImage ( filename, animated ); + YGtkImage *image = YGTK_IMAGE (getWidget()); const char *iconname = NULL; if (endsWith (filename, "/msg_question.png")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-gtk-2.44.3/src/YGInputField.cc new/libyui-gtk-2.44.5/src/YGInputField.cc --- old/libyui-gtk-2.44.3/src/YGInputField.cc 2014-02-24 14:55:54.000000000 +0100 +++ new/libyui-gtk-2.44.5/src/YGInputField.cc 2014-05-06 11:45:52.000000000 +0200 @@ -10,6 +10,11 @@ #include "ygtkfieldentry.h" #include <YInputField.h> +#include <boost/date_time/posix_time/posix_time.hpp> +#include <iostream> +#include <sstream> + +using namespace boost::gregorian; class YGInputField : public YInputField, public YGLabeledWidget { @@ -89,12 +94,15 @@ class YGTimeField : public YTimeField, public YGLabeledWidget { + std::string old_time; public: YGTimeField (YWidget *parent, const std::string &label) : YTimeField (NULL, label), YGLabeledWidget (this, parent, label, YD_HORIZ, YGTK_TYPE_FIELD_ENTRY, NULL) { + // Same default as Qt + old_time = "00:00:00"; YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget()); ygtk_field_entry_add_field (field, ':'); ygtk_field_entry_add_field (field, ':'); @@ -102,15 +110,40 @@ ygtk_field_entry_setup_field (field, 0, 2, "0123456789"); ygtk_field_entry_setup_field (field, 1, 2, "0123456789"); ygtk_field_entry_setup_field (field, 2, 2, "0123456789"); + + setValue ( old_time ); connect (getWidget(), "field-entry-changed", G_CALLBACK (value_changed_cb), this); } + bool validTime(const std::string& input_time) + { + tm tm1; + std::stringstream ss; + ss << input_time; + char c; + + if (!(ss >> tm1.tm_hour)) + return false; + ss >> c; + + if (!(ss >> tm1.tm_min)) + return false; + ss >> c; + + if (!(ss >> tm1.tm_sec)) + return false; + + return (tm1.tm_hour<=23 && tm1.tm_min <= 59 && tm1.tm_sec <= 59); + } + // YTimeField virtual void setValue (const std::string &time) { BlockEvents block (this); if (time.empty()) return; + if (!validTime(time)) return; + char hours[3], mins[3], secs[3]; sscanf (time.c_str(), "%2s:%2s:%2s", hours, mins, secs); @@ -118,12 +151,19 @@ ygtk_field_entry_set_field_text (entry, 0, hours); ygtk_field_entry_set_field_text (entry, 1, mins); ygtk_field_entry_set_field_text (entry, 2, secs); + + old_time = time; } virtual std::string value() { const gchar *hours, *mins, *secs; YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget()); + if (!gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 0)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 1)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 2))) + return old_time; + hours = ygtk_field_entry_get_field_text (entry, 0); mins = ygtk_field_entry_get_field_text (entry, 1); secs = ygtk_field_entry_get_field_text (entry, 2); @@ -137,7 +177,22 @@ // callbacks static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb, YGTimeField *pThis) - { pThis->emitEvent (YEvent::ValueChanged); } + { + if (!gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 0)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 1)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 2))) + return; + + if (pThis->validTime(pThis->value())) + { + pThis->old_time = pThis->value(); + pThis->emitEvent (YEvent::ValueChanged); + } + else + { + pThis->setValue(pThis->old_time); + } + } YGLABEL_WIDGET_IMPL (YTimeField) }; @@ -151,12 +206,15 @@ class YGDateField : public YDateField, public YGLabeledWidget { GtkWidget *m_calendar, *m_popup_calendar; +std::string old_date; public: YGDateField (YWidget *parent, const std::string &label) : YDateField (NULL, label), YGLabeledWidget (this, parent, label, YD_HORIZ, YGTK_TYPE_FIELD_ENTRY, NULL) { + // Same value as QT default + old_date = "2000-01-01"; ygtk_field_entry_add_field (getField(), '-'); ygtk_field_entry_add_field (getField(), '-'); ygtk_field_entry_add_field (getField(), '-'); @@ -172,6 +230,8 @@ ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (menu_button), popup); gtk_widget_show (menu_button); gtk_box_pack_start (GTK_BOX (getWidget()), menu_button, FALSE, TRUE, 6); + + setValue(old_date); connect (getWidget(), "field-entry-changed", G_CALLBACK (value_changed_cb), this); connect (m_calendar, "day-selected", G_CALLBACK (calendar_changed_cb), this); @@ -184,11 +244,25 @@ inline YGtkFieldEntry *getField() { return YGTK_FIELD_ENTRY (getWidget()); } + bool validDate(const std::string& input_date) + { + std::wstringstream ss; + wdate_input_facet * fac = new wdate_input_facet(L"%Y-%m-%d"); + ss.imbue(std::locale(std::locale::classic(), fac)); + + date d; + ss << input_date.c_str(); + ss >> d; + return d != date(); + } + // YDateField virtual void setValue (const std::string &date) { BlockEvents block (this); if (date.empty()) return; + if (!validDate(date)) return; + char year[5], month[3], day[3]; sscanf (date.c_str(), "%4s-%2s-%2s", year, month, day); @@ -198,10 +272,16 @@ ygtk_field_entry_set_field_text (getField(), 0, year); ygtk_field_entry_set_field_text (getField(), 1, month); ygtk_field_entry_set_field_text (getField(), 2, day); + old_date = date; } virtual std::string value() { + if (gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (getField(), 0)) < 4 || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (getField(), 1)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (getField(), 2))) + return old_date; + const gchar *year, *month, *day; year = ygtk_field_entry_get_field_text (getField(), 0); month = ygtk_field_entry_get_field_text (getField(), 1); @@ -218,24 +298,40 @@ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb, YGDateField *pThis) { - int year, month, day; - year = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 0)); - month = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 1)); - day = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 2)); - - if (day < 1 || day > 31 || month < 1 || month > 12) - return; // avoid GtkCalendar warnings - - g_signal_handlers_block_by_func (pThis->getCalendar(), - (gpointer) calendar_changed_cb, pThis); - - gtk_calendar_select_month (pThis->getCalendar(), month-1, year); - gtk_calendar_select_day (pThis->getCalendar(), day); - - g_signal_handlers_unblock_by_func (pThis->getCalendar(), - (gpointer) calendar_changed_cb, pThis); + if (gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 0)) < 4 || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 1)) || + !gtk_entry_get_text_length (ygtk_field_entry_get_field_widget (entry, 2))) + return; + + std::string new_date = pThis->value(); + bool changed = false; + + if (pThis->validDate(new_date)) + { + changed = true; + pThis->old_date = new_date; + } + else + { + pThis->setValue(pThis->old_date); + } + + if (changed) + { + int year, month, day; + year = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 0)); + month = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 1)); + day = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 2)); + + g_signal_handlers_block_by_func (pThis->getCalendar(), + (gpointer) calendar_changed_cb, pThis); + gtk_calendar_select_month (pThis->getCalendar(), month-1, year); + gtk_calendar_select_day (pThis->getCalendar(), day); + g_signal_handlers_unblock_by_func (pThis->getCalendar(), + (gpointer) calendar_changed_cb, pThis); - pThis->emitEvent (YEvent::ValueChanged); + pThis->emitEvent (YEvent::ValueChanged); + } } static void calendar_changed_cb (GtkCalendar *calendar, YGDateField *pThis) @@ -257,6 +353,7 @@ ygtk_field_entry_set_field_text (entry, 1, month_str); ygtk_field_entry_set_field_text (entry, 2, day_str); + pThis->old_date = pThis->value(); g_signal_handlers_unblock_by_func (pThis->getField(), (gpointer) value_changed_cb, pThis); -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org