Hello community,
here is the log from the commit of package yast2-gtk
checked in at Mon Dec 1 12:14:56 CET 2008.
--------
--- yast2-gtk/yast2-gtk.changes 2008-11-21 08:09:00.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-gtk/yast2-gtk.changes 2008-11-30 20:56:04.000000000 +0100
@@ -1,0 +2,7 @@
+Wed Dec 01 10:25:17 CET 2008 - coolo@suse.de
+
+ * fixes to cope with Arabic and other languages of
+ a right-to-left writing style.
+ * 2.17.8
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-gtk-2.17.7.tar.bz2
New:
----
yast2-gtk-2.17.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-gtk.spec ++++++
--- /var/tmp/diff_new_pack.a12316/_old 2008-12-01 12:14:27.000000000 +0100
+++ /var/tmp/diff_new_pack.a12316/_new 2008-12-01 12:14:27.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-gtk (Version 2.17.7)
+# spec file for package yast2-gtk (Version 2.17.8)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -20,12 +20,12 @@
Url: http://en.opensuse.org/YaST2-GTK
Name: yast2-gtk
-Version: 2.17.7
+Version: 2.17.8
Release: 1
License: LGPL v2.1 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-gtk-2.17.7.tar.bz2
+Source0: yast2-gtk-2.17.8.tar.bz2
Prefix: /usr
Source2: yast2-gtk-rpmlintrc
BuildRequires: blocxx-devel gcc-c++ gtk2-devel libxcrypt-devel libzypp-devel yast2-devtools
@@ -48,7 +48,7 @@
Michael Meeks
%prep
-%setup -n yast2-gtk-2.17.7
+%setup -n yast2-gtk-2.17.8
%build
%{prefix}/bin/y2tool y2autoconf
@@ -79,6 +79,10 @@
%{_libdir}/YaST2/plugin/libpy2gtk.so
%{_datadir}/YaST2/gtk
%changelog
+* Mon Dec 01 2008 coolo@suse.de
+ * fixes to cope with Arabic and other languages of
+ a right-to-left writing style.
+ * 2.17.8
* Fri Nov 21 2008 coolo@suse.de
* fixed online update (bnc#446352)
* fixed patterns order.
++++++ yast2-gtk-2.17.7.tar.bz2 -> yast2-gtk-2.17.8.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/ChangeLog new/yast2-gtk-2.17.8/ChangeLog
--- old/yast2-gtk-2.17.7/ChangeLog 2008-11-21 08:08:14.000000000 +0100
+++ new/yast2-gtk-2.17.8/ChangeLog 2008-11-30 20:55:19.000000000 +0100
@@ -1,3 +1,75 @@
+2008-11-30 Ricardo Cruz
+
+ * src/ygtkwizard.c: ensure header text is black to contrast with the
+ white background (independent of style).
+
+2008-11-28 Ricardo Cruz
+
+ * src/YGBarGraph.cc (YPartitionSplitter): fix for arabic: tell GTK
+ to not mirror the splitter since we want to keep the partition's order.
+
+ * src/YGPackageSelector (ListView): fix for arabic: properly align packages
+ names and descriptions to the right (otherwise, Pango tries to be smart
+ when aligning English multi-line text for RTL).
+
+ * src/YGUI.cc (glyph): fix for arabic: on yast initilization a right-arrow
+ is used: make it use a left one for arabic.
+
+ * src/ygtkcellrenderertextpixbuf.c: fix for arabic: made the alignment
+ when an icon is set working properly. (bug fix 449627)
+
+ * src/ygtkfixed.c: fix for arabic: mirror the UI for arabic. libyui probably
+ should do this in the future.
+
+ * src/ygtklinklabel.c: fix for arabic: header open help line's "more"
+ link wasn't being placed properly.
+
+ * src/ygtksteps.c: fix for arabic: mirror the marker placement.
+
+ * src/YGSelectionModel.cc: fixed getMaxDepth() for lists.
+ * src/YGComboBox.cc: when too many items, wrap the combo into columns.
+
+ * src/YGTable.cc (YTable): when the last column alignment flag is set,
+ append a shadow column because GTK doesn't support not having no
+ expand columns.
+
+ * src/yzyppwrapper.cc: i18n fix: use g_utf8_collate in order to properly
+ sort languages and PackageKit categories.
+
+ * src/YGPackageSelector.cc (ListView): arabic fix: because of our previous
+ hack, status column is now 1: adjust tooltips.
+
+ * src/ygtkrichtext.c: arabic fix (bug fix 449600): GtkTextView only detects
+ Arabic in a paragraph per paragraph basis. Work around it so the entire
+ text, including the English parts, are aligned to the right.
+
+ * src/YGDialog.cc: export setTitle() to C code.
+ * src/ygtklinklabel.c: bug fix 449194: "more" link was disapearing on unmap.
+ Not sure why but showing it on map was causing glitches.
+ Just force a resize.
+ * src/ygtkwizard.c: bug fix 449194: update the window title on map (when the
+ wizard is swapped in).
+
+ * src/YGLayout.cc: bug fix 446524: disable those orphan icon buttons
+ in the middle of a box.
+
+ * src/YGLayout.cc, src/YGPushButton.cc & src/YGComboBox.cc: realize
+ doesn't seem very reliable, so was using timeouts. Those can get
+ trigger while the widget is destroyed though which can mean trouble.
+ Use expose then disconnect. Also moved stock button stuff from
+ YGLayout.cc to YGPushButton.cc.
+
+2008-11-23 Ricardo Cruz
+
+ * src/ygtkwizard.c: don't show "more" link on help line if the rest
+ of the text is only markup.
+
+2008-11-21 Michael Meeks
+
+ * src/YGi18n.h: add __ macro for static string tagging
+ * src/pkg-selector-help.h: tag our strings, mangle Christian's
+ 'Jager' to ascii to help (lame y2makepot) fixes 445950
+
2008-11-21 Ricardo Cruz
* src/yzyppwrapper.cc: bug fix 446352: patches were not being shown.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/pkg-selector-help.h new/yast2-gtk-2.17.8/src/pkg-selector-help.h
--- old/yast2-gtk-2.17.7/src/pkg-selector-help.h 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/pkg-selector-help.h 2008-11-30 20:55:19.000000000 +0100
@@ -3,7 +3,7 @@
*/
static const char *pkg_help =
-"<h1>Purpose</h1>"
+__("<h1>Purpose</h1>"
"<p>This tool lets you install, remove, and update applications.</p>"
"<p>openSUSE's software management is also called 'package management'. A package is "
"generally an application bundle, but multiple packages that extend the application "
@@ -68,10 +68,10 @@
"without performing any changes, simply press the button labeled 'Abort'.</p>"
""
"<blockquote><i>Developed by Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt><br>"
-"Thanks to Christian Jäger for co-designing this tool.</i></blockquote>";
+"Thanks to Christian Jager for co-designing this tool.</i></blockquote>");
static const char *patch_help =
-"<h1>Purpose</h1>"
+__("<h1>Purpose</h1>"
"<p>This tool gives you control on overviewing and picking patches. You may also "
"reverse patches that have been applied to the system.</p>"
""
@@ -89,5 +89,5 @@
"are very restrained in pushing patches; you can be sure that all patches are "
"of signficant severity.</p>"
"<p>If you are looking for applications enhancements, you should check for Upgrades "
-"on the Software Manager.</p>";
+"on the Software Manager.</p>");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGBarGraph.cc new/yast2-gtk-2.17.8/src/YGBarGraph.cc
--- old/yast2-gtk-2.17.7/src/YGBarGraph.cc 2008-11-19 10:24:44.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGBarGraph.cc 2008-11-30 20:55:19.000000000 +0100
@@ -93,6 +93,10 @@
m_new_spin = gtk_spin_button_new_with_range
(minNewPartSize, maxNewPartSize(), 1);
+ // keep the partition's order
+ gtk_widget_set_direction (labels_box, GTK_TEXT_DIR_LTR);
+ gtk_widget_set_direction (slider_box, GTK_TEXT_DIR_LTR);
+
gtk_box_pack_start (GTK_BOX (slider_box), m_free_spin, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (slider_box), m_scale, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (slider_box), m_new_spin, FALSE, FALSE, 0);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGComboBox.cc new/yast2-gtk-2.17.8/src/YGComboBox.cc
--- old/yast2-gtk-2.17.7/src/YGComboBox.cc 2008-11-19 10:24:44.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGComboBox.cc 2008-11-30 20:55:19.000000000 +0100
@@ -37,12 +37,15 @@
connect (getWidget(), "changed",
G_CALLBACK (selected_changed_cb), this);
+ // realize doesn't seem reliable -- expose then disconnect
+ g_signal_connect (G_OBJECT (getWidget()), "expose-event",
+ G_CALLBACK (realize_cb), this);
}
inline GtkComboBox *getComboBox()
{ return GTK_COMBO_BOX (getWidget()); }
- GtkEntry *getEntry ()
+ GtkEntry *getEntry()
{
if (!GTK_IS_COMBO_BOX_ENTRY (getWidget())) {
yuiError() << "YGComboBox: trying to edit read-only combo box\n";
@@ -127,6 +130,19 @@
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YComboBox)
YGSELECTION_WIDGET_IMPL_ALL (YComboBox)
+
+ static gboolean realize_cb (GtkWidget *widget, GdkEventExpose *event,
+ YGComboBox *pThis)
+ {
+ // some combo boxes have too many items -- wrap the thing in columns
+ int rows;
+ pThis->getMaxDepth (&rows);
+ int cols = MIN (rows / 20, 5) + 1;
+ if (cols > 1) // this changes the popup width, so only set it for cols > 1
+ gtk_combo_box_set_wrap_width (pThis->getComboBox(), cols);
+ g_signal_handlers_disconnect_by_func (widget, (gpointer) realize_cb, pThis);
+ return FALSE;
+ }
};
YComboBox *YGWidgetFactory::createComboBox (YWidget *parent, const string &label, bool editable)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGDialog.cc new/yast2-gtk-2.17.8/src/YGDialog.cc
--- old/yast2-gtk-2.17.7/src/YGDialog.cc 2008-11-19 10:24:44.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGDialog.cc 2008-11-30 20:55:19.000000000 +0100
@@ -523,13 +523,11 @@
void YGDialog::setTitle (const std::string &title, bool sticky)
{
+ if (title.empty())
+ return;
if (!m_stickyTitle || sticky) {
GtkWindow *window = GTK_WINDOW (m_window->getWidget());
- gchar *str;
- if (title.empty())
- str = g_strdup ("YaST");
- else
- str = g_strdup_printf ("%s - YaST", title.c_str());
+ gchar *str = g_strdup_printf ("%s - YaST", title.c_str());
gtk_window_set_title (window, str);
g_free (str);
m_stickyTitle = sticky;
@@ -537,6 +535,15 @@
present();
}
+extern "C" {
+ void ygdialog_setTitle (const gchar *title, gboolean sticky);
+};
+
+void ygdialog_setTitle (const gchar *title, gboolean sticky)
+{
+ YGDialog::currentDialog()->setTitle (title, sticky);
+}
+
void YGDialog::setIcon (const std::string &icon)
{
GtkWindow *window = GTK_WINDOW (m_window->getWidget());
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGi18n.h new/yast2-gtk-2.17.8/src/YGi18n.h
--- old/yast2-gtk-2.17.7/src/YGi18n.h 2008-06-03 07:46:11.000000000 +0200
+++ new/yast2-gtk-2.17.8/src/YGi18n.h 2008-11-30 20:55:19.000000000 +0100
@@ -25,6 +25,9 @@
#define TEXTDOMAIN "yast2-gtk"
+// tag for translation but don't translate; no N_ in y2makepot ...
+#define __(a) (a)
+
static inline const char * _( const char * msgid )
{
return ( !msgid || !*msgid ) ? "" : dgettext( TEXTDOMAIN, msgid );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGPackageSelector.cc new/yast2-gtk-2.17.8/src/YGPackageSelector.cc
--- old/yast2-gtk-2.17.7/src/YGPackageSelector.cc 2008-11-21 08:08:14.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGPackageSelector.cc 2008-11-30 20:55:19.000000000 +0100
@@ -435,12 +435,17 @@
gtk_cell_renderer_set_fixed_size (renderer, -1, height);
}
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gboolean reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
+ if (reverse) { // work-around: Pango ignored alignment flag on RTL
+ gtk_widget_set_direction (m_widget, GTK_TEXT_DIR_LTR);
+ g_object_set (renderer, "alignment", PANGO_ALIGN_RIGHT, NULL);
+ }
column = gtk_tree_view_column_new_with_attributes ("", renderer,
"markup", YGtkZyppModel::NAME_DESCRIPTION_COLUMN, NULL);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (column, 50 /* it will expand */);
gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_append_column (view, column);
+ gtk_tree_view_insert_column (view, column, reverse ? 0 : -1);
gtk_tree_view_set_fixed_height_mode (view, TRUE);
gtk_tree_view_set_show_expanders (view, FALSE); /* would conflict with icons */
@@ -556,7 +561,9 @@
view, x, y, &bx, &by);
gtk_tree_view_get_path_at_pos (
view, x, y, NULL, &column, NULL, NULL);
- if (column == gtk_tree_view_get_column (view, 0)) {
+ int status_col =
+ gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL ? 1 : 0;
+ if (column == gtk_tree_view_get_column (view, status_col)) {
if (package->toInstall()) {
if (package->isInstalled())
text = _("To re-install a different version");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGPushButton.cc new/yast2-gtk-2.17.8/src/YGPushButton.cc
--- old/yast2-gtk-2.17.7/src/YGPushButton.cc 2008-11-19 10:24:44.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGPushButton.cc 2008-11-30 20:55:19.000000000 +0100
@@ -4,10 +4,12 @@
#include
#include
-#include "YPushButton.h"
+#include
#include "YGUtils.h"
#include "YGWidget.h"
+#include
+
class YGPushButton : public YPushButton, public YGWidget
{
bool m_customIcon, m_labelIcon;
@@ -21,7 +23,9 @@
m_customIcon = m_labelIcon = false;
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
setLabel (label);
- connect (getWidget (), "clicked", G_CALLBACK (clicked_cb), this);
+ connect (getWidget(), "clicked", G_CALLBACK (clicked_cb), this);
+ g_signal_connect (G_OBJECT (getWidget()), "expose-event",
+ G_CALLBACK (treat_icon_cb), this);
}
void setStockIcon (const std::string &label)
@@ -90,7 +94,7 @@
m_customIcon = true;
string path (icon);
if (path[0] != '/')
- path = ICON_DIR + path;
+ path = std::string (THEMEDIR) + "/" + path;
GError *error = 0;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
@@ -125,6 +129,33 @@
}
}
+ static gboolean treat_icon_cb (GtkWidget *widget, GdkEventExpose *event,
+ YGPushButton *pThis)
+ {
+ // only set stock icons if all to the left have them
+ YLayoutBox *ybox = dynamic_cast (pThis->parent());
+ if (ybox && ybox->primary() == YD_HORIZ && !pThis->m_customIcon) {
+ YWidget *ylast = 0;
+ for (YWidgetListConstIterator it = ybox->childrenBegin();
+ it != ybox->childrenEnd(); it++) {
+ if ((YWidget *) pThis == *it) {
+ if (ylast) {
+ GtkWidget *button = YGWidget::get (ylast)->getWidget();
+ GtkWidget *icon = gtk_button_get_image (GTK_BUTTON (button));
+ if (!icon || !GTK_WIDGET_VISIBLE (icon))
+ pThis->setIcon ("");
+ }
+ break;
+ }
+ ylast = *it;
+ if (!dynamic_cast (ylast))
+ ylast = NULL;
+ }
+ }
+ g_signal_handlers_disconnect_by_func (widget, (gpointer) treat_icon_cb, pThis);
+ return FALSE;
+ }
+
// Events
static void clicked_cb (GtkButton *button, YGPushButton *pThis)
{ pThis->emitEvent (YEvent::Activated, IGNORE_NOTIFY_EVENT); }
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGSelectionModel.cc new/yast2-gtk-2.17.8/src/YGSelectionModel.cc
--- old/yast2-gtk-2.17.7/src/YGSelectionModel.cc 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGSelectionModel.cc 2008-11-30 20:55:19.000000000 +0100
@@ -200,7 +200,6 @@
int YGSelectionModel::getMaxDepth (int *rows)
{
- if (!isTree) return 0;
GtkTreeModel *model = getModel();
int depth = 0; *rows = 0;
GtkTreeIter iter;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGTable.cc new/yast2-gtk-2.17.8/src/YGTable.cc
--- old/yast2-gtk-2.17.7/src/YGTable.cc 2008-11-19 10:24:44.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGTable.cc 2008-11-30 20:55:19.000000000 +0100
@@ -68,8 +68,10 @@
case YAlignUnchanged:
break;
}
- if (xalign != -1)
+ if (xalign != -1) {
g_object_set (renderer, "xalign", xalign, NULL);
+ gtk_tree_view_column_set_alignment (column, xalign);
+ }
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (getView(), column);
@@ -93,6 +95,12 @@
gtk_tree_view_append_column (getView(), column);
}
+ void appendDumbColumn()
+ {
+ IMPL
+ gtk_tree_view_append_column (getView(), gtk_tree_view_column_new());
+ }
+
void setModel()
{ gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), getModel()); }
@@ -216,7 +224,11 @@
createModel (types);
for (int i = 0; i < columns(); i++) {
int col = i*2;
- appendIconTextColumn (header (i), alignment (i), col, col+1);
+ YAlignmentType align = alignment (i);
+ appendIconTextColumn (header (i), align, col, col+1);
+ if ((align == YAlignCenter || align == YAlignEnd) && i == columns()-1)
+ // if last col is aligned: add another so that it doesn't expand.
+ appendDumbColumn();
}
setModel();
@@ -274,6 +286,8 @@
GList *columns = gtk_tree_view_get_columns (getView());
for (GList *i = columns; i; i = i->next, n++) {
GtkTreeViewColumn *column = (GtkTreeViewColumn *) i->data;
+ if (n >= this->columns())
+ break;
if (sortable) {
int index = (n*2)+1;
if (!sortable)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtkcellrenderertextpixbuf.c new/yast2-gtk-2.17.8/src/ygtkcellrenderertextpixbuf.c
--- old/yast2-gtk-2.17.7/src/ygtkcellrenderertextpixbuf.c 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtkcellrenderertextpixbuf.c 2008-11-30 20:55:19.000000000 +0100
@@ -79,6 +79,8 @@
return NULL;
}
+#define BORDER 1
+
static void ygtk_cell_renderer_text_pixbuf_get_size (GtkCellRenderer *cell,
GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
gint *width, gint *height)
@@ -110,15 +112,14 @@
g_object_unref (G_OBJECT (layout));
}
- *width += cell->xpad*2;
- *height += cell->ypad*2 + 2;
+ *width += (cell->xpad+BORDER)*2;
+ *height += (cell->ypad+BORDER)*2;
}
static void ygtk_cell_renderer_text_pixbuf_render (GtkCellRenderer *cell,
GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area,
GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
{
- GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (cell);
YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (cell);
GtkStateType state;
@@ -140,45 +141,55 @@
state = GTK_STATE_NORMAL;
}
- int x = cell_area->x, y = cell_area->y;
+ // positioning
+ gboolean reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
gfloat xalign = cell->xalign, yalign = cell->yalign;
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ if (reverse)
xalign = 1.0 - xalign;
- if (tpcell->pixbuf) {
- int w, h;
- w = gdk_pixbuf_get_width (tpcell->pixbuf);
- h = gdk_pixbuf_get_height (tpcell->pixbuf);
-
- int xoffset, yoffset;
- xoffset = xalign * (cell_area->width - (w + (2*cell->xpad)));
- yoffset = yalign * (cell_area->height - (h + (2*cell->ypad)));
-
- cairo_t *cr = gdk_cairo_create (window);
- gdk_cairo_set_source_pixbuf (cr, tpcell->pixbuf, x+xoffset, y+yoffset);
-
- cairo_rectangle (cr, x+xoffset, y+yoffset, w, h);
- cairo_fill (cr);
- cairo_destroy (cr);
-
- x += w + PIXBUF_TEXT_SPACING;
+ GdkPixbuf *pixbuf = tpcell->pixbuf;
+ int pixbuf_width = 0, pixbuf_height = 0;
+ if (pixbuf) {
+ pixbuf_width = gdk_pixbuf_get_width (pixbuf);
+ pixbuf_height = gdk_pixbuf_get_height (pixbuf);
}
- if (tcell->text) {
- PangoLayout *layout = create_layout (tpcell, widget);
-
+ PangoLayout *layout = create_layout (tpcell, widget);
+ int text_width = 0, text_height = 0;
+ if (layout) {
PangoRectangle rect;
pango_layout_get_pixel_extents (layout, NULL, &rect);
+ text_width = rect.width;
+ text_height = rect.height;
+ }
- int xoffset, yoffset;
- xoffset = xalign * (cell_area->width - (rect.width + (2*cell->xpad)));
- yoffset = yalign * (cell_area->height - (rect.height + (2*cell->ypad)));
+ int spacing = (text_width && pixbuf_width) ? PIXBUF_TEXT_SPACING : 0;
+ int offset_x = xalign * (cell_area->width - (text_width + pixbuf_width + spacing));
+ int text_x = offset_x, text_y;
+ if (pixbuf_width && !reverse)
+ text_x += (pixbuf_width + spacing);
+ text_y = yalign * (cell_area->height - text_height);
+
+ int pixbuf_x = offset_x, pixbuf_y;
+ if (text_width && reverse)
+ pixbuf_x += (text_width + spacing);
+ pixbuf_y = yalign * (cell_area->height - pixbuf_height);
+
+ // paint
+ int x = cell_area->x + cell->xpad+BORDER, y = cell_area->y + cell->ypad+BORDER;
+ if (pixbuf) {
+ cairo_t *cr = gdk_cairo_create (window);
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, pixbuf_x+x, pixbuf_y+y);
+ cairo_rectangle (cr, pixbuf_x+x, pixbuf_y+y, pixbuf_width, pixbuf_height);
+ cairo_fill (cr);
+ cairo_destroy (cr);
+ }
+ if (layout) {
GtkStyle *style = gtk_widget_get_style (widget);
gtk_paint_layout (style, window, state, TRUE, expose_area, widget,
- "cellrenderertext", x+xoffset, y+yoffset, layout);
-
+ "cellrenderertext", text_x+x, text_y+y, layout);
g_object_unref (G_OBJECT (layout));
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtkfixed.c new/yast2-gtk-2.17.8/src/ygtkfixed.c
--- old/yast2-gtk-2.17.7/src/ygtkfixed.c 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtkfixed.c 2008-11-30 20:55:19.000000000 +0100
@@ -91,8 +91,7 @@
}
}
-static void ygtk_fixed_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+static void ygtk_fixed_size_request (GtkWidget *widget, GtkRequisition *requisition)
{
YGtkFixed *fixed = YGTK_FIXED (widget);
fixed->preferred_size_cb (fixed, &requisition->width, &requisition->height,
@@ -101,8 +100,7 @@
GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_request (widget, requisition);
}
-static void ygtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+static void ygtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
YGtkFixed *fixed = YGTK_FIXED (widget);
fixed->set_size_cb (fixed, allocation->width, allocation->height, fixed->data);
@@ -110,7 +108,10 @@
GSList *i;
for (i = fixed->children; i; i = i->next) {
YGtkFixedChild *child = i->data;
- int x = child->x + allocation->x;
+ int x = child->x;
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
+ x = allocation->width - (child->x + child->width);
+ x += allocation->x;
int y = child->y + allocation->y;
GtkAllocation child_alloc =
{ x, y, child->width, child->height };
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtklinklabel.c new/yast2-gtk-2.17.8/src/ygtklinklabel.c
--- old/yast2-gtk-2.17.7/src/ygtklinklabel.c 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtklinklabel.c 2008-11-30 20:55:19.000000000 +0100
@@ -55,6 +55,14 @@
GTK_WIDGET_CLASS (ygtk_link_label_parent_class)->unrealize (widget);
}
+static void ygtk_link_label_map (GtkWidget *widget)
+{
+ // "more" hides on unmap and for some reason showing it clears the
+ // text...
+ gtk_widget_queue_resize (widget);
+ GTK_WIDGET_CLASS (ygtk_link_label_parent_class)->map (widget);
+}
+
static void ygtk_link_label_clear_layout (YGtkLinkLabel *label)
{
if (label->layout) {
@@ -74,7 +82,6 @@
label->layout = gtk_widget_create_pango_layout (widget, label->text);
pango_layout_set_single_paragraph_mode (label->layout, TRUE);
pango_layout_set_ellipsize (label->layout, PANGO_ELLIPSIZE_END);
- pango_layout_set_width (label->layout, widget->allocation.width * PANGO_SCALE);
}
if (!label->link_layout) {
label->link_layout = gtk_widget_create_pango_layout (widget, label->link);
@@ -118,8 +125,7 @@
#define SPACING 4
-static void ygtk_link_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+static void ygtk_link_label_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
GTK_WIDGET_CLASS (ygtk_link_label_parent_class)->size_allocate (widget, allocation);
YGtkLinkLabel *label = YGTK_LINK_LABEL (widget);
@@ -139,9 +145,12 @@
x = allocation->x + logical.width/PANGO_SCALE + SPACING;
else
x = allocation->x + (allocation->width - link_width);
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ x = (2*allocation->x + allocation->width) - (x + link_width);
gdk_window_move_resize (label->link_window, x,
allocation->y, link_width, allocation->height);
- pango_layout_set_width (label->layout, width);
+ if (logical.width > width)
+ pango_layout_set_width (label->layout, width);
gdk_window_show (label->link_window);
}
else
@@ -157,6 +166,11 @@
gint x = 0, y = 0;
PangoLayout *layout = 0;
if (event->window == widget->window) {
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) {
+ PangoRectangle extent;
+ pango_layout_get_extents (label->layout, NULL, &extent);
+ x = widget->allocation.width - extent.width/PANGO_SCALE;
+ }
x += widget->allocation.x;
y += widget->allocation.y;
layout = label->layout;
@@ -204,6 +218,7 @@
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->realize = ygtk_link_label_realize;
widget_class->unrealize = ygtk_link_label_unrealize;
+ widget_class->map = ygtk_link_label_map;
widget_class->size_request = ygtk_link_label_size_request;
widget_class->size_allocate = ygtk_link_label_size_allocate;
widget_class->expose_event = ygtk_link_label_expose_event;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtkrichtext.c new/yast2-gtk-2.17.8/src/ygtkrichtext.c
--- old/yast2-gtk-2.17.7/src/ygtkrichtext.c 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtkrichtext.c 2008-11-30 20:55:19.000000000 +0100
@@ -358,6 +358,7 @@
void ygtk_rich_text_init (YGtkRichText *rtext)
{
+ GtkWidget *widget = GTK_WIDGET (rtext);
GtkTextView *tview = GTK_TEXT_VIEW (rtext);
gtk_text_view_set_wrap_mode (tview, GTK_WRAP_WORD_CHAR);
gtk_text_view_set_editable (tview, FALSE);
@@ -366,12 +367,12 @@
gtk_text_view_set_left_margin (tview, 4);
// Init link support
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (rtext));
+ GdkDisplay *display = gtk_widget_get_display (widget);
rtext->hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
gdk_cursor_ref (rtext->hand_cursor);
#if GTK_CHECK_VERSION(2,10,0)
- gtk_widget_style_get (GTK_WIDGET (rtext), "link_color", &link_color, NULL);
+ gtk_widget_style_get (widget, "link_color", &link_color, NULL);
#endif
g_signal_connect (tview, "event-after",
@@ -379,11 +380,12 @@
// Create a few tags like 'h3', 'b', 'i'. others need to be created as we parse
GtkTextBuffer *buffer = gtk_text_view_get_buffer (tview);
- PangoFontDescription *font_desc = GTK_WIDGET (rtext)->style->font_desc;
+ PangoFontDescription *font_desc = widget->style->font_desc;
int size = pango_font_description_get_size (font_desc);
if (pango_font_description_get_size_is_absolute (font_desc))
size /= PANGO_SCALE;
+ gtk_text_buffer_create_tag (buffer, "body", NULL);
gtk_text_buffer_create_tag (buffer, "h1", "weight", PANGO_WEIGHT_HEAVY,
"size", (int)(size * PANGO_SCALE_XX_LARGE), "pixels-below-lines", 16,
"foreground", "#5c5c5c", NULL);
@@ -410,6 +412,7 @@
gtk_text_buffer_create_tag (buffer, "i", "style", PANGO_STYLE_ITALIC, NULL);
gtk_text_buffer_create_tag (buffer, "u", "underline", PANGO_UNDERLINE_SINGLE, NULL);
gtk_text_buffer_create_tag (buffer, "center", "justification", GTK_JUSTIFY_CENTER, NULL);
+ gtk_text_buffer_create_tag (buffer, "right", "justification", GTK_JUSTIFY_RIGHT, NULL);
// helpers
gtk_text_buffer_create_tag (buffer, "keyword", "background", "yellow", NULL);
}
@@ -592,9 +595,6 @@
gpointer user_data,
GError **error)
{ // Called for open tags <foo bar="baz">
- if (!g_ascii_strcasecmp (element_name, "body"))
- return;
-
GRTParseState *state = (GRTParseState*) user_data;
GRTPTag *tag = g_malloc (sizeof (GRTPTag));
GtkTextIter iter;
@@ -712,9 +712,6 @@
gpointer user_data,
GError **error)
{ // Called for close tags </foo>
- if (!g_ascii_strcasecmp (element_name, "body"))
- return;
-
GRTParseState *state = (GRTParseState*) user_data;
if (g_list_length (state->htags) == 0) {
@@ -835,6 +832,26 @@
return g_object_new (YGTK_TYPE_RICH_TEXT, NULL);
}
+static void ygtk_rich_text_set_rtl (YGtkRichText *rtext)
+{
+ GtkTextView *view = GTK_TEXT_VIEW (rtext);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+ GtkTextIter iter;
+ gtk_text_buffer_get_start_iter (buffer, &iter);
+ do {
+ GtkTextIter end = iter;
+ if (!gtk_text_iter_forward_line (&end))
+ gtk_text_buffer_get_end_iter (buffer, &end);
+
+ gchar *text = gtk_text_iter_get_text (&iter, &end);
+ PangoDirection dir = pango_find_base_dir (text, -1);
+ if (dir == PANGO_DIRECTION_LTR)
+ gtk_text_buffer_apply_tag_by_name (buffer, "right", &iter, &end);
+
+ iter = end;
+ } while (!gtk_text_iter_is_end (&iter));
+}
+
void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text, gboolean plain_mode)
{
GtkTextBuffer *buffer;
@@ -871,6 +888,11 @@
if (gtk_text_iter_backward_char (&before_end_it) &&
gtk_text_iter_get_char (&before_end_it) == '\n')
gtk_text_buffer_delete (buffer, &before_end_it, &end_it);
+
+ // GtkTextView does LTR and RTL depending on the paragraph; we want
+ // to change that behavior so it's RTL to the all thing for Arabic
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
+ ygtk_rich_text_set_rtl (rtext);
}
/* gtk_text_iter_forward_search() is case-sensitive so we roll our own.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtksteps.c new/yast2-gtk-2.17.8/src/ygtksteps.c
--- old/yast2-gtk-2.17.7/src/ygtksteps.c 2008-11-09 09:28:28.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtksteps.c 2008-11-30 20:55:19.000000000 +0100
@@ -29,8 +29,12 @@
PangoContext *context = gtk_widget_get_pango_context (GTK_WIDGET (steps));
steps->check_mark_layout = pango_layout_new (context);
steps->current_mark_layout = pango_layout_new (context);
- pango_layout_set_markup (steps->check_mark_layout, "\u2714", -1);
- pango_layout_set_markup (steps->current_mark_layout, "<b>\u2192</b>", -1);
+
+ const gchar *check = "\u2714", *current = "<b>\u2192</b>";
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
+ current = "<b>\u2190</b>";
+ pango_layout_set_markup (steps->check_mark_layout, check, -1);
+ pango_layout_set_markup (steps->current_mark_layout, current, -1);
steps->current_mark_timeout_id = steps->current_mark_frame = 0;
}
@@ -77,6 +81,7 @@
GTK_WIDGET_CLASS (ygtk_steps_parent_class)->expose_event (widget, event);
YGtkSteps *steps = YGTK_STEPS (widget);
+ gboolean reverse = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
GtkStyle *style = gtk_widget_get_style (widget);
GList *children = gtk_container_get_children (GTK_CONTAINER (widget)), *i;
int n = 0;
@@ -88,13 +93,21 @@
PangoLayout *mark = (n == steps->current_step) ?
steps->current_mark_layout : steps->check_mark_layout;
int x = label->allocation.x, y = label->allocation.y;
- x += 4;
+ if (reverse) {
+ PangoRectangle rect;
+ pango_layout_get_pixel_extents (mark, NULL, &rect);
+ x += label->allocation.width - rect.width - 4;
+ }
+ else
+ x += 4;
if (n == steps->current_step) {
+ int offset;
if (steps->current_mark_frame < CURRENT_MARK_FRAMES_NB/2)
- x -= steps->current_mark_frame * CURRENT_MARK_ANIMATION_OFFSET;
+ offset = steps->current_mark_frame * CURRENT_MARK_ANIMATION_OFFSET;
else
- x -= (CURRENT_MARK_FRAMES_NB - steps->current_mark_frame) *
+ offset = (CURRENT_MARK_FRAMES_NB - steps->current_mark_frame) *
CURRENT_MARK_ANIMATION_OFFSET;
+ x += offset * (reverse ? 1 : -1);
}
gtk_paint_layout (style, widget->window, GTK_STATE_NORMAL, TRUE,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/ygtkwizard.c new/yast2-gtk-2.17.8/src/ygtkwizard.c
--- old/yast2-gtk-2.17.7/src/ygtkwizard.c 2008-11-09 09:28:28.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/ygtkwizard.c 2008-11-30 20:55:19.000000000 +0100
@@ -30,6 +30,7 @@
extern gboolean ygutils_setStockIcon (GtkWidget *button, const char *label,
const char *fallbackIcon);
extern GdkPixbuf *ygutils_setOpacity (const GdkPixbuf *src, int opacity, gboolean alpha);
+extern void ygdialog_setTitle (const gchar *title, gboolean sticky);
//** YGtkHelpDialog
@@ -372,10 +373,13 @@
gtk_misc_set_alignment (GTK_MISC (header->title), 0, 0.5);
ygutils_setWidgetFont (header->title, PANGO_STYLE_NORMAL, PANGO_WEIGHT_BOLD,
PANGO_SCALE_X_LARGE);
+ GdkColor black = { 0, 0, 0, 0 }; // set text to black cause of some style colors
+ gtk_widget_modify_fg (header->title, GTK_STATE_NORMAL, &black);
header->description = ygtk_link_label_new ("", _("more"));
g_signal_connect (G_OBJECT (header->description), "link-clicked",
G_CALLBACK (description_link_clicked_cb), header);
+ gtk_widget_modify_fg (header->description, GTK_STATE_NORMAL, &black);
header->icon = gtk_image_new();
@@ -400,6 +404,8 @@
static void ygtk_wizard_header_class_init (YGtkWizardHeaderClass *klass)
{
+ ygtk_wizard_header_parent_class = g_type_class_peek_parent (klass);
+
more_clicked_signal = g_signal_new ("more-clicked",
G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (YGtkWizardHeaderClass, more_clicked), NULL, NULL,
@@ -460,11 +466,19 @@
}
}
}
- gboolean cut = FALSE;
+ gboolean cut = FALSE, markup = FALSE;
for (; text[i]; i++) {
- if (!g_ascii_isspace (text[i])) {
- cut = TRUE;
- break;
+ if (markup) {
+ if (text[i] == '>')
+ markup = FALSE;
+ }
+ else {
+ if (text[i] == '<')
+ markup = TRUE;
+ else if (!g_ascii_isspace (text[i])) {
+ cut = TRUE;
+ break;
+ }
}
}
gchar *desc = g_string_free (str, FALSE);
@@ -695,6 +709,16 @@
gtk_widget_grab_focus (wizard->next_button);
}
+static void ygtk_wizard_map (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->map (widget);
+ // since wizards can swap the window, we need to update the title on map
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+ YGtkWizardHeader *header = YGTK_WIZARD_HEADER (wizard->m_title);
+ const gchar *title = gtk_label_get_text (GTK_LABEL (header->title));
+ ygdialog_setTitle (strcmp (title, "YaST") ? title : "", FALSE);
+}
+
static gboolean clear_hash_cb (gpointer key, gpointer value, gpointer data)
{ return TRUE; }
static void clear_hash (GHashTable *hash_table)
@@ -1108,6 +1132,7 @@
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
widget_class->realize = ygtk_wizard_realize;
+ widget_class->map = ygtk_wizard_map;
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
gtkobject_class->destroy = ygtk_wizard_destroy;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGUI.cc new/yast2-gtk-2.17.8/src/YGUI.cc
--- old/yast2-gtk-2.17.7/src/YGUI.cc 2008-11-05 11:09:13.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGUI.cc 2008-11-30 20:55:19.000000000 +0100
@@ -539,7 +539,7 @@
if (sym == YUIGlyph_CheckMark)
return "\u2714";
if (sym == YUIGlyph_BulletArrowRight)
- return "\u279c";
+ return (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL) ? "\u21e6" : "\u279c";
if (sym == YUIGlyph_BulletCircle)
return "\u274d";
if (sym == YUIGlyph_BulletSquare)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/YGUtils.cc new/yast2-gtk-2.17.8/src/YGUtils.cc
--- old/yast2-gtk-2.17.7/src/YGUtils.cc 2008-11-09 09:28:28.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/YGUtils.cc 2008-11-30 20:55:19.000000000 +0100
@@ -331,6 +331,7 @@
// we want to use GtkImage stock mode so it honors sensitive
GtkWidget *image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_widget_show (image);
}
}
else {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/src/yzyppwrapper.cc new/yast2-gtk-2.17.8/src/yzyppwrapper.cc
--- old/yast2-gtk-2.17.7/src/yzyppwrapper.cc 2008-11-21 08:08:14.000000000 +0100
+++ new/yast2-gtk-2.17.8/src/yzyppwrapper.cc 2008-11-30 20:55:19.000000000 +0100
@@ -1162,6 +1162,7 @@
virtual std::string name()
{ return m_locale.name(); }
+
virtual std::string summary()
{
int installed, total;
@@ -1289,6 +1290,12 @@
Package *b = (Package *) _b;
return strcasecmp (a->name().c_str(), b->name().c_str());
}
+ static gint compare_utf8 (gconstpointer _a, gconstpointer _b)
+ { // slower -- don't use for packages -- only for patterns and languages
+ Package *a = (Package *) _a;
+ Package *b = (Package *) _b;
+ return g_utf8_collate (a->name().c_str(), b->name().c_str());
+ }
static gint compare_pattern (gconstpointer a, gconstpointer b)
{
ZyppPattern pattern1 = tryCastToZyppPattern (((PackageSel *) ((Package *) a)->impl)->m_sel->theObj());
@@ -1379,6 +1386,8 @@
// a sort merge. Don't use g_slist_insert_sorted() -- its linear
if (type == Ypp::Package::PATTERN_TYPE)
pool = g_slist_sort (pool, inner::compare_pattern);
+ else if (type == Ypp::Package::LANGUAGE_TYPE)
+ pool = g_slist_sort (pool, inner::compare_utf8);
else
pool = g_slist_sort (pool, inner::compare);
packages[type] = pool;
@@ -2036,7 +2045,7 @@
return !strcmp (b, "Other") ? 0 : 1;
if (!strcmp (b, "Other"))
return -1;
- return strcmp (a, b);
+ return strcasecmp (a, b);
}
};
@@ -2064,7 +2073,7 @@
struct inner {
static int cmp (const char *a, const char *b)
{
- int r = strcmp (a, b);
+ int r = g_utf8_collate (a, b);
if (r != 0) {
const char *unknown = zypp_tag_group_enum_to_localised_text
(PK_GROUP_ENUM_UNKNOWN);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-gtk-2.17.7/VERSION new/yast2-gtk-2.17.8/VERSION
--- old/yast2-gtk-2.17.7/VERSION 2008-11-21 08:08:33.000000000 +0100
+++ new/yast2-gtk-2.17.8/VERSION 2008-11-30 20:55:51.000000000 +0100
@@ -1 +1 @@
-2.17.7
+2.17.8
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org