Author: rpmcruz Date: Tue Feb 1 23:47:18 2011 New Revision: 63301 URL: http://svn.opensuse.org/viewcvs/yast?rev=63301&view=rev Log: - printer crash fix: printer tool was misbehaving, somestimes crashing, when selecting tree item. (Reported by Atri Bhattacharya.) - silenced log printouts when reducing window size to 0. Added: trunk/gtk/tests/Tree-rebuild.ycp Modified: trunk/gtk/package/yast2-gtk.changes trunk/gtk/src/YGComboBox.cc trunk/gtk/src/YGSelectionStore.h trunk/gtk/src/YGTreeView.cc trunk/gtk/src/ygtkfixed.c trunk/gtk/src/ygtkratiobox.c Modified: trunk/gtk/package/yast2-gtk.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/package/yast2-gtk.changes?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/package/yast2-gtk.changes (original) +++ trunk/gtk/package/yast2-gtk.changes Tue Feb 1 23:47:18 2011 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Feb 01 22:43:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt + +- 2.21.90 +- printer crash fix: printer tool was misbehaving, somestimes +crashing, when selecting tree item. (Reported by Atri Bhattacharya.) + +------------------------------------------------------------------- Fri Jan 28 18:03:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt - 2.21.89 Modified: trunk/gtk/src/YGComboBox.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/src/YGComboBox.cc (original) +++ trunk/gtk/src/YGComboBox.cc Tue Feb 1 23:47:18 2011 @@ -48,6 +48,8 @@ // YGSelectionModel + void blockSelected() {} + void doAddItem (YItem *item) { GtkTreeIter iter; Modified: trunk/gtk/src/YGSelectionStore.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionStore.h?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/src/YGSelectionStore.h (original) +++ trunk/gtk/src/YGSelectionStore.h Tue Feb 1 23:47:18 2011 @@ -49,6 +49,7 @@ } \ virtual void deleteAllItems() { \ ParentClass::deleteAllItems(); \ + blockSelected(); \ doDeleteAllItems(); \ } \ virtual void selectItem (YItem *item, bool select) { \ Modified: trunk/gtk/src/YGTreeView.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTreeView.cc?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/src/YGTreeView.cc (original) +++ trunk/gtk/src/YGTreeView.cc Tue Feb 1 23:47:18 2011 @@ -236,7 +236,7 @@ void blockSelected() { // GtkTreeSelection only fires when idle; so set a timeout if (m_blockTimeout) g_source_remove (m_blockTimeout); - m_blockTimeout = g_timeout_add_full (G_PRIORITY_LOW, 250, block_selected_timeout_cb, this, NULL); + m_blockTimeout = g_timeout_add_full (G_PRIORITY_LOW, 50, block_selected_timeout_cb, this, NULL); } static void block_init_cb (GtkWidget *widget, YGTreeView *pThis) @@ -676,6 +676,7 @@ GtkTreeIter iter; addRow (item, &iter, parent); setRowText (&iter, 0, item->iconName(), 1, item->label(), this); +#if 0 // yast2-qt ignores `selected flag if (item->selected()) { #if YAST2_VERSION >= 2019002 if (hasMultiSelection()) @@ -684,14 +685,17 @@ #endif focusItem (item, true); } -/* if (((YTreeItem *) item)->isOpen()) - expand (&iter);*/ +#endif +#if 0 + if (((YTreeItem *) item)->isOpen()) + expand (&iter); +#endif for (YItemConstIterator it = item->childrenBegin(); it != item->childrenEnd(); it++) addNode (*it, &iter); } -/* +#if 0 void expand (GtkTreeIter *iter) { GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter); @@ -706,12 +710,14 @@ return false; return true; } -*/ +#endif // YTree virtual void rebuildTree() { + blockSelected(); + doDeleteAllItems(); for (YItemConstIterator it = YTree::itemsBegin(); it != YTree::itemsEnd(); it++) addNode (*it, NULL); @@ -734,7 +740,10 @@ } }; + g_signal_handlers_block_by_func (getWidget(), (gpointer) row_expanded_cb, this); gtk_tree_model_foreach (getModel(), inner::foreach_sync_open, this); + g_signal_handlers_unblock_by_func (getWidget(), (gpointer) row_expanded_cb, this); + syncCount(); } Modified: trunk/gtk/src/ygtkfixed.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.c?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/src/ygtkfixed.c (original) +++ trunk/gtk/src/ygtkfixed.c Tue Feb 1 23:47:18 2011 @@ -114,7 +114,7 @@ x += allocation->x; int y = child->y + allocation->y; GtkAllocation child_alloc = - { x, y, child->width, child->height }; + { x, y, MAX (child->width, 1), MAX (child->height, 1) }; gtk_widget_size_allocate (child->widget, &child_alloc); } GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_allocate (widget, allocation); Modified: trunk/gtk/src/ygtkratiobox.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=63301&r1=63300&r2=63301&view=diff ============================================================================== --- trunk/gtk/src/ygtkratiobox.c (original) +++ trunk/gtk/src/ygtkratiobox.c Tue Feb 1 23:47:18 2011 @@ -184,6 +184,8 @@ child_alloc.width = width; child_alloc.height = child_length; } + child_alloc.width = MAX (child_alloc.width, 1); + child_alloc.height = MAX (child_alloc.height, 1); gtk_widget_size_allocate (child->widget, &child_alloc); child_pos += child_length + box->spacing; @@ -336,6 +338,8 @@ child_alloc.y += border; child_alloc.width -= border * 2; child_alloc.height -= border * 2; + child_alloc.width = MAX (child_alloc.width, 1); + child_alloc.height = MAX (child_alloc.height, 1); gtk_widget_size_allocate (child, &child_alloc); } GTK_WIDGET_CLASS (ygtk_adj_size_parent_class)->size_allocate (widget, allocation); Added: trunk/gtk/tests/Tree-rebuild.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/tests/Tree-rebuild.ycp?rev=63301&view=auto ============================================================================== --- trunk/gtk/tests/Tree-rebuild.ycp (added) +++ trunk/gtk/tests/Tree-rebuild.ycp Tue Feb 1 23:47:18 2011 @@ -0,0 +1,50 @@ +{ + // Test Case for Bug 668602 + // Crashing in printer tool: when rebuilding tree after item is selected. + // See if Label is properly set to the item selected. + + UI::OpenDialog(`VBox ( + `Tree(`id(`tree), + `opt(`notify), + "Select destination directory:", + [ + `item( "/" , true, + [ + `item( "etc", + [ + `item("opt"), + `item("SuSEconfig"), + `item("X11") + ] + ) + ] + ) + ] ), + `Label (`id (`label), "Selected: (none)") + ) + ); + + any id = nil; + + repeat + { + id = UI::UserInput(); + + any item = UI::QueryWidget (`tree, `CurrentItem); + + UI::ChangeWidget( `id( `label ), `Value, sformat( "%1", item ) ); + + + UI::ChangeWidget (`tree, `Items, ( [ + `item( "Option 1:" , true, + [ + `item( "Value 1" , true ), + `item( "Value 2" , true ) + ] ) + ])); + + + } until ( id == `cancel ); + UI::CloseDialog(); +} + -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org