Author: rpmcruz Date: Mon Dec 31 00:46:07 2007 New Revision: 43249 URL: http://svn.opensuse.org/viewcvs/yast?rev=43249&view=rev Log: * src/ygtkzyppwrapper.cc: noticed, from another project, that we should handle some special cases there on the model. I guess the views aren't using them, but we better. * src/YGPackageSelector.cc: hide Patches entry for ordinary package management (sw_single doesn't init patches, so only installed were shown, which could fool the user into not using the online_update). Of course, we are still pooling patches for the changes pane. We need to improve filtering to avoid this. We could allow for multiple instances of some Filter object for a Pool, acting on them as if they were an union. But I guess I'd just do that in a Field-basis. Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGPackageSelector.cc trunk/gtk/src/ygtkzyppwrapper.cc Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=43249&r1=43248&r2=43249&view=diff ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Mon Dec 31 00:46:07 2007 @@ -1,3 +1,17 @@ +2007-12-30 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> + + * src/ygtkzyppwrapper.cc: noticed, from another project, that we should handle + some special cases there on the model. I guess the views aren't using them, + but we better. + + * src/YGPackageSelector.cc: hide Patches entry for ordinary package management + (sw_single doesn't init patches, so only installed were shown, which could fool + the user into not using the online_update). + Of course, we are still pooling patches for the changes pane. We need to improve + filtering to avoid this. We could allow for multiple instances of some Filter object + for a Pool, acting on them as if they were an union. But I guess I'd just + do that in a Field-basis. + 2007-12-21 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * src/yzyppwrapper.cc (Pool): build pool even for unintialized types. Modified: trunk/gtk/src/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=43249&r1=43248&r2=43249&view=diff ============================================================================== --- trunk/gtk/src/YGPackageSelector.cc (original) +++ trunk/gtk/src/YGPackageSelector.cc Mon Dec 31 00:46:07 2007 @@ -854,7 +854,8 @@ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Categories")); gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patterns")); gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Languages")); - gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patches")); + if (update_mode) + gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patches")); gtk_combo_box_set_active (GTK_COMBO_BOX (m_type), update_mode ? 3 : 0); g_signal_connect_after (G_OBJECT (m_type), "changed", G_CALLBACK (combo_changed_cb), this); Modified: trunk/gtk/src/ygtkzyppwrapper.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.cc?rev=43249&r1=43248&r2=43249&view=diff ============================================================================== --- trunk/gtk/src/ygtkzyppwrapper.cc (original) +++ trunk/gtk/src/ygtkzyppwrapper.cc Mon Dec 31 00:46:07 2007 @@ -253,32 +253,49 @@ } } -static gboolean ygtk_zypp_model_iter_children (GtkTreeModel *model, GtkTreeIter *iter, - GtkTreeIter *parent) +static gboolean ygtk_zypp_model_iter_has_child (GtkTreeModel *model, GtkTreeIter *iter) { - return FALSE; + return FALSE; } -static gboolean ygtk_zypp_model_iter_has_child (GtkTreeModel *model, GtkTreeIter *iter) +static gboolean ygtk_zypp_model_iter_parent (GtkTreeModel *model, GtkTreeIter *iter, + GtkTreeIter *child) { return FALSE; } static gint ygtk_zypp_model_iter_n_children (GtkTreeModel *model, GtkTreeIter *iter) { + if (iter == NULL) { // special case: root + YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model); + int length = 0; + Ypp::Pool::Iter iter = zmodel->pool->getFirst(); + while (iter) { + length++; + iter = zmodel->pool->getNext (iter); + } + return length; + } return 0; } static gboolean ygtk_zypp_model_iter_nth_child (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *parent, gint n) { + if (parent == NULL) { + gboolean ret; + GtkTreePath *path = gtk_tree_path_new_from_indices (n, -1); + ret = ygtk_zypp_model_get_iter (model, iter, path); + gtk_tree_path_free (path); + return ret; + } return FALSE; } -static gboolean ygtk_zypp_model_iter_parent (GtkTreeModel *model, GtkTreeIter *iter, - GtkTreeIter *child) +static gboolean ygtk_zypp_model_iter_children (GtkTreeModel *model, GtkTreeIter *iter, + GtkTreeIter *parent) { - return FALSE; + return ygtk_zypp_model_iter_nth_child (model, iter, parent, 0); } YGtkZyppModel *ygtk_zypp_model_new (Ypp::Query *query) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org