Author: rpmcruz
Date: Fri Dec 5 18:36:31 2008
New Revision: 53956
URL: http://svn.opensuse.org/viewcvs/yast?rev=53956&view=rev
Log:
* src/YGPushButton.cc: bug fix 449320: for a vertical Box: either
have stock icons for all buttons, or disable it for all.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPushButton.cc
trunk/gtk/tests/StockButtons.ycp
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=53956&r1=53955&r2=53956&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Dec 5 18:36:31 2008
@@ -1,3 +1,8 @@
+2008-12-05 Ricardo Cruz
+
+ * src/YGPushButton.cc: bug fix 449320: for a vertical Box: either
+ have stock icons for all buttons, or disable it for all.
+
2008-12-05 Michael Meeks
* tests/Wizard2.ycp: try to add a test for 449773.
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=53956&r1=53955&r2=53956&view=diff
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Fri Dec 5 18:36:31 2008
@@ -149,27 +149,52 @@
}
}
+ static bool hasIcon (YWidget *ywidget)
+ {
+ if (dynamic_cast (ywidget)) {
+ GtkWidget *button = YGWidget::get (ywidget)->getWidget();
+ GtkWidget *icon = gtk_button_get_image (GTK_BUTTON (button));
+ return icon && GTK_WIDGET_VISIBLE (icon);
+ }
+ return true;
+ }
+
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))
+ if (ybox && !pThis->m_customIcon) {
+ if (ybox->primary() == YD_HORIZ) {
+ // only set stock icons if all to the left have them
+ YWidget *ylast = 0;
+ for (YWidgetListConstIterator it = ybox->childrenBegin();
+ it != ybox->childrenEnd(); it++) {
+ if ((YWidget *) pThis == *it) {
+ if (ylast && !hasIcon (ylast))
pThis->setIcon ("");
+ break;
}
- break;
+ ylast = *it;
+ if (!dynamic_cast (ylast))
+ ylast = NULL;
}
- ylast = *it;
- if (!dynamic_cast (ylast))
- ylast = NULL;
+ }
+ else { // YD_VERT
+ // different strategy: set icons for all or none
+ bool disableIcons = false;
+ for (YWidgetListConstIterator it = ybox->childrenBegin();
+ it != ybox->childrenEnd(); it++)
+ if (!hasIcon (*it))
+ disableIcons = true;
+ if (disableIcons)
+ for (YWidgetListConstIterator it = ybox->childrenBegin();
+ it != ybox->childrenEnd(); it++)
+ if (dynamic_cast (*it)) {
+ YGPushButton *button = (YGPushButton *)
+ YGWidget::get (*it);
+ if (!button->m_customIcon)
+ button->setIcon ("");
+ }
}
}
g_signal_handlers_disconnect_by_func (widget, (gpointer) treat_icon_cb, pThis);
Modified: trunk/gtk/tests/StockButtons.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/tests/StockButtons.ycp?rev=53956&r1=53955&r2=53956&view=diff
==============================================================================
--- trunk/gtk/tests/StockButtons.ycp (original)
+++ trunk/gtk/tests/StockButtons.ycp Fri Dec 5 18:36:31 2008
@@ -1,11 +1,17 @@
{
UI::OpenDialog(
+ `VBox(
+ `PushButton ("&Add"),
+ `PushButton ("&Edit"),
+ `PushButton ("&Resize"),
+ `PushButton ("&Remove"),
`HBox(
`PushButton ("&Add"),
`PushButton ("&Edit"),
`PushButton ("&Resize"),
`PushButton ("&Remove")
)
+ )
);
UI::UserInput();
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org