Author: rpmcruz
Date: Fri Jan 11 06:57:14 2008
New Revision: 43548
URL: http://svn.opensuse.org/viewcvs/yast?rev=43548&view=rev
Log:
* src/YGLayout.cc (YGAlignment): some changes there; doesn't yet fix
alignment issues though...
* src/YGUtils.cc: got rid of strcmp and contains. To use library
equivalents.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/yzyppwrapper.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=43548&r1=43547&r2=43548&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Jan 11 06:57:14 2008
@@ -6,6 +6,12 @@
* src/yzyppwrapper.cc: fixed changelog (markup typo :/). changed
date format.
+ * src/YGLayout.cc (YGAlignment): some changes there; doesn't yet fix
+ alignment issues though...
+
+ * src/YGUtils.cc: got rid of strcmp and contains. To use library
+ equivalents.
+
2007-01-08 Ricardo Cruz
* src/YGUI.h/cc: keep up with libyui: file dialogs moved to YApplication.
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=43548&r1=43547&r2=43548&view=diff
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Fri Jan 11 06:57:14 2008
@@ -164,9 +164,9 @@
yscale = (valign == YAlignUnchanged) ? 1 : 0;
if (hasChildren()) {
// special case: child has stretch opt
- if (firstChild()->stretchable (YD_HORIZ))
+ if (!xscale && firstChild()->stretchable (YD_HORIZ))
xscale = 1;
- if (firstChild()->stretchable (YD_VERT))
+ if (!yscale && firstChild()->stretchable (YD_VERT))
yscale = 1;
}
gtk_alignment_set (GTK_ALIGNMENT (getWidget()), xalign, yalign, xscale, yscale);
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=43548&r1=43547&r2=43548&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Fri Jan 11 06:57:14 2008
@@ -401,50 +401,6 @@
void ygutils_setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale)
{ YGUtils::setWidgetFont (widget, weight, scale); }
-int YGUtils::strcmp (const char *str1, const char *str2)
-{
- // (if you think this is ugly, just wait for the Perl version! :P)
- const char *i, *j;
- for (i = str1, j = str2; *i && *j; i++, j++) {
- // number comparasion
- if (isdigit (*i) && isdigit (*j)) {
- int n1, n2;
- for (n1 = 0; isdigit (*i); i++)
- n1 = (*i - '0') + (n1 * 10);
- for (n2 = 0; isdigit (*j); j++)
- n2 = (*j - '0') + (n2 * 10);
-
- if (n1 != n2)
- return n1 - n2;
-
- // prepare for loop
- i--; j--;
- }
-
- // regular character comparasion
- else if (g_ascii_tolower (*i) != g_ascii_tolower(*j))
- return g_ascii_tolower (*i) - g_ascii_tolower (*j);
- }
- if (*i)
- return -1;
- if (*j)
- return 1;
- return 0; // identicals
-}
-
-bool YGUtils::contains (const string &haystack, const string &needle)
-{
- unsigned int i, j;
- for (i = 0; i < haystack.length(); i++) {
- for (j = 0; j < needle.length() && i+j < haystack.length(); j++)
- if (g_ascii_tolower (haystack[i+j]) != g_ascii_tolower (needle[j]))
- break;
- if (j == needle.length())
- return true;
- }
- return false;
-}
-
std::list <string> YGUtils::splitString (const string &str, char separator)
{
std::list <string> parts;
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=43548&r1=43547&r2=43548&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Fri Jan 11 06:57:14 2008
@@ -45,13 +45,6 @@
/* Sets some widget font proprities. */
void setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale);
- /* A more sane strcmp() from the user point of view that honors numbers.
- i.e. "20" < "100" */
- int strcmp (const char *str1, const char *str2);
-
- /* Checks if a std::string contains some other string (case insensitive). */
- bool contains (const std::string &haystack, const std::string &needle);
-
/* Splits a string into parts as separated by the separator characters.
eg: splitString ("Office/Writer", '/') => { "Office", "Writer" } */
std::list std::string splitString (const std::string &str, char separator);
Modified: trunk/gtk/src/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=43548&r1=43547&r2=43548&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Fri Jan 11 06:57:14 2008
@@ -290,7 +290,7 @@
ZyppObject object = impl->zyppSel->installedObj();
ZyppPackage package = tryCastToZyppPkg (object);
if (package) {
- StringTree tree (YGUtils::strcmp, '/');
+ StringTree tree (strcmp, '/');
const std::list std::string &filesList = package->filenames();
for (std::list std::string::const_iterator it = filesList.begin();
@@ -784,9 +784,9 @@
const std::list std::string &values = names.values;
std::list std::string::const_iterator it;
for (it = values.begin(); it != values.end(); it++)
- if (!YGUtils::contains (package->name(), *it) &&
- !YGUtils::contains (package->summary(), *it) &&
- !YGUtils::contains (package->provides(), *it)) {
+ if (package->name().find (*it) == std::string::npos &&
+ package->summary().find (*it) == std::string::npos &&
+ package->provides().find (*it) == std::string::npos) {
match = false;
break;
}
@@ -1057,7 +1057,7 @@
return !strcmp (b, "Other") ? 0 : 1;
if (!strcmp (b, "Other"))
return -1;
- return YGUtils::strcmp (a, b);
+ return strcmp (a, b);
}
};
@@ -1297,7 +1297,7 @@
{
Package *a = (Package *) _a;
Package *b = (Package *) _b;
- return YGUtils::strcmp (a->name().c_str(), b->name().c_str());
+ return a->name().compare (b->name());
}
};
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org