Author: rpmcruz
Date: Thu Mar 4 18:35:20 2010
New Revision: 61157
URL: http://svn.opensuse.org/viewcvs/yast?rev=61157&view=rev
Log:
* src/YGWidget.cc: bug fix 583228: misplacing colon
when using English text on Arabic layout.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGWidget.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=61157&r1=61156&r2=61157&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Mar 4 18:35:20 2010
@@ -1,3 +1,8 @@
+2010-03-04 Ricardo Cruz
+
+ * src/YGWidget.cc: bug fix 583228: misplacing colon
+ when using English text on Arabic layout.
+
2010-03-03 Ricardo Cruz
* src/YGUI.cc: bug fix 582148: a few strings should be
Modified: trunk/gtk/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=61157&r1=61156&r2=61157&view=diff
==============================================================================
--- trunk/gtk/src/YGWidget.cc (original)
+++ trunk/gtk/src/YGWidget.cc Thu Mar 4 18:35:20 2010
@@ -270,19 +270,23 @@
void YGLabeledWidget::doSetLabel (const std::string &label)
{
if (!label.empty()) {
- string str = YGUtils::mapKBAccel (label);
+ string str (YGUtils::mapKBAccel (label));
+
+ // add a ':' at the end of the label, if not set
+ if (!str.empty()) {
+ const gchar *last = g_utf8_find_prev_char (str.c_str(), str.c_str() + str.length());
+ gunichar last_char = g_utf8_get_char (last);
+ if (g_unichar_isalpha (last_char)) { // append
+ bool reverse = false;
+ if (gtk_widget_get_direction (m_label) == GTK_TEXT_DIR_RTL &&
+ pango_find_base_dir (str.c_str(), -1) == PANGO_DIRECTION_LTR)
+ reverse = true;
+
+ int i = reverse ? 0 : str.length();
+ str.insert (i, 1, ':');
+ }
+ }
- // add a ':' at the end
- const gchar *last = g_utf8_find_prev_char (str.c_str(), str.c_str() + str.length());
- gunichar last_char = g_utf8_get_char (last);
- if (g_unichar_isalpha (last_char))
- str += ':';
-
-/* // set it as upper case
- unsigned int first = (str [0] == '_') ? 1 : 0;
- if (str [first] >= 'a' && str [first] <= 'z')
- str [first] += 'A' - 'a';
-*/
gtk_label_set_text (GTK_LABEL (m_label), str.c_str());
gtk_label_set_use_underline (GTK_LABEL (m_label), TRUE);
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org