Author: rpmcruz
Date: Wed May 7 01:52:56 2008
New Revision: 47338
URL: http://svn.opensuse.org/viewcvs/yast?rev=47338&view=rev
Log:
* src/YGTable.cc (YGTree): fixed bug 381648 - 3rd issue - make
`open state behaving mimic that of -qt.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGSelectionModel.cc
trunk/gtk/src/YGSelectionModel.h
trunk/gtk/src/YGTable.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47338&r1=47337&r2=47338&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Wed May 7 01:52:56 2008
@@ -11,6 +11,9 @@
* src/YGPackageSelector.cc (PackageControl): massaged it a little more
for bug 381689, so it fits 800x600.
+ * src/YGTable.cc (YGTree): fixed bug 381648 - 3rd issue - make
+ `open state behaving mimic that of -qt.
+
2008-05-05 Ricardo Cruz
* Fixed y2log warnings across the various files: y2error() ->
Modified: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=47338&r1=47337&r2=47338&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (original)
+++ trunk/gtk/src/YGSelectionModel.cc Wed May 7 01:52:56 2008
@@ -63,8 +63,15 @@
setFocusItem (&iter);
YTreeItem *tree_item = dynamic_cast (item);
- if (tree_item && tree_item->isOpen())
- expand (&iter);
+ if (tree_item && tree_item->isOpen()) {
+ // only expand if all parent's are expand too
+ YTreeItem *i;
+ for (i = tree_item->parent(); i; i = i->parent())
+ if (!i->isOpen())
+ break;
+ if (!i)
+ expand (&iter);
+ }
}
void YGSelectionModel::doDeleteAllItems()
@@ -82,7 +89,7 @@
return (YItem *) ptr;
}
-bool YGSelectionModel::getIter (YItem *item, GtkTreeIter *iter)
+bool YGSelectionModel::getIter (const YItem *item, GtkTreeIter *iter)
{
if (!item)
return false;
Modified: trunk/gtk/src/YGSelectionModel.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.h?rev=47338&r1=47337&r2=47338&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.h (original)
+++ trunk/gtk/src/YGSelectionModel.h Wed May 7 01:52:56 2008
@@ -37,7 +37,7 @@
virtual void expand (GtkTreeIter *iter) {}
YItem *getItem (GtkTreeIter *iter);
- bool getIter (YItem *item, GtkTreeIter *iter);
+ bool getIter (const YItem *item, GtkTreeIter *iter);
bool findByText (const string &text, GtkTreeIter *iter);
void addRow (GtkTreeIter *iter, YItem *item, bool honor_select);
Modified: trunk/gtk/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=47338&r1=47337&r2=47338&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Wed May 7 01:52:56 2008
@@ -421,13 +421,9 @@
// YGSelectionModel
virtual void expand (GtkTreeIter *iter)
{
- g_signal_handlers_block_by_func (getWidget(), (gpointer) row_expanded_cb, this);
-
GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter);
gtk_tree_view_expand_to_path (getView(), path);
gtk_tree_path_free (path);
-
- g_signal_handlers_unblock_by_func (getWidget(), (gpointer) row_expanded_cb, this);
}
// callbacks
@@ -445,6 +441,20 @@
GtkTreePath *path, YGTree *pThis)
{
pThis->setRowOpen (iter, true);
+
+ // we do a bit of a work-around here to mimic -qt behavior... A node can
+ // be initialized as open, yet its parent, or some grand-parent, be closed.
+ // We thus honor the open state when its parent gets open.
+ YTreeItem *item = static_cast (pThis->getItem (iter));
+ for (YItemConstIterator it = item->childrenBegin();
+ it != item->childrenEnd(); it++) {
+ const YTreeItem *child = static_cast (*it);
+ if (child->isOpen()) {
+ GtkTreeIter iter;
+ if (pThis->getIter (child, &iter))
+ pThis->expand (&iter);
+ }
+ }
}
YGWIDGET_IMPL_COMMON
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org