[yast-commit] r53752 - in /trunk/gtk: ChangeLog src/YGDialog.cc src/YGLayout.cc src/ygtkwizard.c tests/StockButtons.ycp tests/StockIcons.ycp

Author: rpmcruz Date: Fri Nov 28 23:45:56 2008 New Revision: 53752 URL: http://svn.opensuse.org/viewcvs/yast?rev=53752&view=rev Log: * src/YGLayout.cc: bug fix 446524: disable those orphan icon buttons in the middle of a box. Added: trunk/gtk/tests/StockButtons.ycp Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGDialog.cc trunk/gtk/src/YGLayout.cc trunk/gtk/src/ygtkwizard.c trunk/gtk/tests/StockIcons.ycp Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=53752&r1=53751&... ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Fri Nov 28 23:45:56 2008 @@ -45,6 +45,9 @@ * 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. + 2008-11-23 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * src/ygtkwizard.c: don't show "more" link on help line if the rest Modified: trunk/gtk/src/YGDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=53752&r1=... ============================================================================== --- trunk/gtk/src/YGDialog.cc (original) +++ trunk/gtk/src/YGDialog.cc Fri Nov 28 23:45:56 2008 @@ -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; Modified: trunk/gtk/src/YGLayout.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=53752&r1=... ============================================================================== --- trunk/gtk/src/YGLayout.cc (original) +++ trunk/gtk/src/YGLayout.cc Fri Nov 28 23:45:56 2008 @@ -78,6 +78,9 @@ { setBorder (0); YGLAYOUT_INIT + if (dim == YD_HORIZ) + // realize doesn't seem to work, so... + g_timeout_add_full (G_PRIORITY_LOW, 50, treat_button_icons_cb, this, NULL); } virtual void addChild (YWidget *ychild) @@ -90,6 +93,26 @@ YGWIDGET_IMPL_CHILD_REMOVED (getWidget()) YGLAYOUT_PREFERRED_SIZE_IMPL (YLayoutBox) YGLAYOUT_SET_SIZE_IMPL (YLayoutBox) + + static gboolean treat_button_icons_cb (gpointer pData) + { + YGLayoutBox *pThis = (YGLayoutBox *) pData; + // only set stock icons if all to the left have them + bool enable = true; + for (YWidgetListConstIterator it = pThis->childrenBegin(); + it != pThis->childrenEnd(); it++) { + YPushButton *ybutton = dynamic_cast <YPushButton *> (*it); + if (ybutton) { + GtkWidget *button = YGWidget::get (ybutton)->getWidget(); + GtkWidget *icon = gtk_button_get_image (GTK_BUTTON (button)); + if (enable) + enable = icon != NULL; + else if (icon) + gtk_widget_hide (icon); + } + } + return FALSE; + } }; YLayoutBox *YGWidgetFactory::createLayoutBox (YWidget *parent, YUIDimension dimension) Modified: trunk/gtk/src/ygtkwizard.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=53752&r1... ============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Fri Nov 28 23:45:56 2008 @@ -711,7 +711,7 @@ 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 (title, FALSE); + ygdialog_setTitle (strcmp (title, "YaST") ? title : "", FALSE); } static gboolean clear_hash_cb (gpointer key, gpointer value, gpointer data) Added: trunk/gtk/tests/StockButtons.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/tests/StockButtons.ycp?rev=53... ============================================================================== --- trunk/gtk/tests/StockButtons.ycp (added) +++ trunk/gtk/tests/StockButtons.ycp Fri Nov 28 23:45:56 2008 @@ -0,0 +1,14 @@ +{ + UI::OpenDialog( + `HBox( + `PushButton ("&Add"), + `PushButton ("&Edit"), + `PushButton ("&Resize"), + `PushButton ("&Remove") + ) + ); + + UI::UserInput(); + UI::CloseDialog(); +} + Modified: trunk/gtk/tests/StockIcons.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/tests/StockIcons.ycp?rev=5375... ============================================================================== --- trunk/gtk/tests/StockIcons.ycp (original) +++ trunk/gtk/tests/StockIcons.ycp Fri Nov 28 23:45:56 2008 @@ -2,23 +2,23 @@ { list stock_icons = [ - "ok", - "cancel", - "abort", - "apply", - "about", - "connect", - "disconnect", - "edit", - "open", - "close", - "new", - "quit", - "print", - "save", - "save-as", - "yes", - "no", + "Ok", + "Cancel", + "Abort", + "Apply", + "About", + "Connect", + "Disconnect", + "Edit", + "Open", + "Close", + "New", + "Quit", + "Print", + "Save", + "Save As", + "Yes", + "No", ]; integer i = 0; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rpmcruz@svn.opensuse.org