[yast-commit] r43220 - in /trunk/gtk/src: YGPackageSelector.cc yzyppwrapper.cc yzyppwrapper.h

Author: rpmcruz Date: Fri Dec 21 11:53:29 2007 New Revision: 43220 URL: http://svn.opensuse.org/viewcvs/yast?rev=43220&view=rev Log: * src/yzyppwrapper.cc (Pool): build pool even for unintialized types. * src/YGPackageSelector.cc (ChangesPane): reflect pool at start. A bit hacky, besides we may want to do this only for Patches... Modified: trunk/gtk/src/YGPackageSelector.cc trunk/gtk/src/yzyppwrapper.cc trunk/gtk/src/yzyppwrapper.h Modified: trunk/gtk/src/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=... ============================================================================== --- trunk/gtk/src/YGPackageSelector.cc (original) +++ trunk/gtk/src/YGPackageSelector.cc Fri Dec 21 11:53:29 2007 @@ -344,7 +344,7 @@ { return m_box; } ChangesPane() - : m_entries (NULL) + : m_container (NULL), m_entries (NULL) { GtkWidget *heading = gtk_label_new (_("Changes:")); YGUtils::setWidgetFont (heading, PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_LARGE); @@ -379,6 +379,10 @@ Ypp::Query *query = new Ypp::Query(); query->setIsModified (true); m_pool = new Ypp::Pool (query); + // initialize list -- there could already be packages modified + for (Ypp::Pool::Iter it = m_pool->getFirst(); it; it = m_pool->getNext (it)) { + ChangesPane::entryInserted (it, m_pool->get (it)); + } m_pool->setListener (this); } @@ -393,7 +397,14 @@ void setContainer (GtkWidget *container) { m_container = container; - gtk_widget_hide (m_container); + if (!m_entries) + gtk_widget_hide (m_container); + // ugly: signal modified for all entries to allow them to hide undo buttons + GList *i; + Ypp::Pool::Iter it; + for (it = m_pool->getFirst(), i = m_entries; it && i; + it = m_pool->getNext (it), i = i->next) + ((Entry *) i->data)->modified (m_pool->get (it)); } virtual void entryInserted (Ypp::Pool::Iter iter, Ypp::Package *package) @@ -402,7 +413,8 @@ gtk_box_pack_start (GTK_BOX (m_entries_box), entry->getWidget(), FALSE, TRUE, 0); int index = m_pool->getIndex (iter); m_entries = g_list_insert (m_entries, entry, index); - gtk_widget_show (m_container); + if (m_container) + gtk_widget_show (m_container); } virtual void entryDeleted (Ypp::Pool::Iter iter, Ypp::Package *package) @@ -413,7 +425,7 @@ gtk_container_remove (GTK_CONTAINER (m_entries_box), entry->getWidget()); delete entry; m_entries = g_list_delete_link (m_entries, i); - if (m_entries == NULL) + if (!m_entries) gtk_widget_hide (m_container); } Modified: trunk/gtk/src/yzyppwrapper.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=43220... ============================================================================== --- trunk/gtk/src/yzyppwrapper.cc (original) +++ trunk/gtk/src/yzyppwrapper.cc Fri Dec 21 11:53:29 2007 @@ -732,7 +732,7 @@ } bool is (const T &v) const { -// if (!defined) return true; + if (!defined) return true; return value == v; } bool defined; Modified: trunk/gtk/src/yzyppwrapper.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=43220&... ============================================================================== --- trunk/gtk/src/yzyppwrapper.h (original) +++ trunk/gtk/src/yzyppwrapper.h Fri Dec 21 11:53:29 2007 @@ -110,6 +110,8 @@ // Pool struct Pool { + // TODO: add a flag to check if the pool should be constructed at initilization + // e.g. it may make no sense to try to build for the ChangesPane. Pool (Query *query); typedef void * Iter; -- 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