Author: rpmcruz
Date: Mon May 5 19:06:23 2008
New Revision: 47297
URL: http://svn.opensuse.org/viewcvs/yast?rev=47297&view=rev
Log:
* Fixed y2log warnings across the various files: y2error() ->
yuiError().
* src/YGDumbTab.cc: fixed 381195: Query items of DumbTab broken with Gtk.
* src/YGLayout.cc: set all buttons of same height.
* src/YGRadioButton.cc: fixed bug 373160: support all radio buttons
being disabled.
* src/YGTable.cc: fixed bug 381746: immediateMode() can now change
return on run-time.
* src/YGTable.cc: fixed bug 381648: let libyui know when the user
expands and collapses rows.
* src/YGUtils.cc: fixed bug 384135: warning cause of disconnecting a
signal when was never connected.
* src/YGUtils.cc: fixed bug: scroll YLog text down properly.
* src/YGWizard.cc: fixed bug 384649: must re-load stock icon when
button changes senstitive state.
* src/ygtkratiobox.c: fixed bug 373159: long windows -- hack for now:
let's make use of the new gtk layout stuff when it becomes available.
* src/ygtkwizard.c: fixed bug: growing wizard headers.
* src/yzyppwrapper.cc & src/YGPackageSelector.cc: fixed patterns install
state, and added popup with info about them like -qt.
* src/yzyppwrapper.cc & src/ygtkzyppwrapper.cc: added highlighting for
exact matches.
* src/YGPackageSelector.cc: some massage for bug 381689: reduced
default size, changed installed version layout button a bit.
Added:
trunk/gtk/src/YGTextView.cc
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/Makefile.am
trunk/gtk/src/YGBarGraph.cc
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGDumbTab.cc
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGInputField.cc
trunk/gtk/src/YGIntField.cc
trunk/gtk/src/YGLabel.cc
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGMenuButton.cc
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGProgressBar.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGRadioButton.cc
trunk/gtk/src/YGSelectionModel.cc
trunk/gtk/src/YGTable.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGWidget.cc
trunk/gtk/src/YGWizard.cc
trunk/gtk/src/ygtkratiobox.c
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkzyppwrapper.cc
trunk/gtk/src/ygtkzyppwrapper.h
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon May 5 19:06:23 2008
@@ -1,3 +1,41 @@
+2008-05-05 Ricardo Cruz
+
+ * Fixed y2log warnings across the various files: y2error() ->
+ yuiError().
+
+ * src/YGDumbTab.cc: fixed 381195: Query items of DumbTab broken with Gtk.
+
+ * src/YGLayout.cc: set all buttons of same height.
+
+ * src/YGRadioButton.cc: fixed bug 373160: support all radio buttons
+ being disabled.
+
+ * src/YGTable.cc: fixed bug 381746: immediateMode() can now change
+ return on run-time.
+ * src/YGTable.cc: fixed bug 381648: let libyui know when the user
+ expands and collapses rows.
+
+ * src/YGUtils.cc: fixed bug 384135: warning cause of disconnecting a
+ signal when was never connected.
+ * src/YGUtils.cc: fixed bug: scroll YLog text down properly.
+
+ * src/YGWizard.cc: fixed bug 384649: must re-load stock icon when
+ button changes senstitive state.
+
+ * src/ygtkratiobox.c: fixed bug 373159: long windows -- hack for now:
+ let's make use of the new gtk layout stuff when it becomes available.
+
+ * src/ygtkwizard.c: fixed bug: growing wizard headers.
+
+ * src/yzyppwrapper.cc & src/YGPackageSelector.cc: fixed patterns install
+ state, and added popup with info about them like -qt.
+
+ * src/yzyppwrapper.cc & src/ygtkzyppwrapper.cc: added highlighting for
+ exact matches.
+
+ * src/YGPackageSelector.cc: some massage for bug 381689: reduced
+ default size, changed installed version layout button a bit.
+
2008-04-21 Michael Meeks
* src/YGSelectionModel.cc (findByText): implemented.
Modified: trunk/gtk/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Makefile.am?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/Makefile.am (original)
+++ trunk/gtk/src/Makefile.am Mon May 5 19:06:23 2008
@@ -26,7 +26,7 @@
YGPushButton.cc \
YGProgressBar.cc \
YGInputField.cc \
- YGMultiLineEdit.cc \
+ YGTextView.cc \
YGIntField.cc \
YGRadioButton.cc \
YGImage.cc \
Modified: trunk/gtk/src/YGBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGBarGraph.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGBarGraph.cc (original)
+++ trunk/gtk/src/YGBarGraph.cc Mon May 5 19:06:23 2008
@@ -3,8 +3,7 @@
********************************************************************/
#include
-#include
-#include
+#include "YGUI.h"
#include "YGWidget.h"
#include "ygtkbargraph.h"
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGUtils.h"
#include "YComboBox.h"
@@ -51,7 +50,7 @@
GtkEntry *getEntry ()
{
if (!GTK_IS_COMBO_BOX_ENTRY (getWidget())) {
- y2error ("YGComboBox: trying to edit read-only combo box");
+ yuiError() << "YGComboBox: trying to edit read-only combo box\n";
return NULL;
}
Modified: trunk/gtk/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include "YGUI.h"
#include "YGDialog.h"
#include
@@ -192,7 +191,7 @@
}
if ((event->state & GDK_CONTROL_MASK) && (event->state & GDK_SHIFT_MASK)
&& (event->state & GDK_MOD1_MASK)) {
- y2milestone ("Caught YaST2 magic key combination");
+ yuiMilestone() << "Caught YaST2 magic key combination\n";
switch (event->keyval) {
case GDK_S:
YGUI::ui()->makeScreenShot();
@@ -207,7 +206,7 @@
YGUI::ui()->sendEvent (new YDebugEvent());
return TRUE;
case GDK_X:
- y2milestone ("Starting xterm");
+ yuiMilestone() << "Starting xterm\n";
system ("/usr/bin/xterm &");
return TRUE;
case GDK_T:
Modified: trunk/gtk/src/YGDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDumbTab.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGDumbTab.cc (original)
+++ trunk/gtk/src/YGDumbTab.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGWidget.h"
#include "YGUtils.h"
@@ -79,6 +78,7 @@
selectItem (item, item->selected() || !m_last_tab /*first tab*/);
g_signal_handlers_unblock_by_func (notebook, (gpointer) changed_tab_cb, this);
+ YDumbTab::addItem (item);
}
virtual void deleteAllItems()
@@ -87,6 +87,7 @@
for (GList *i = children; i; i = i->next)
gtk_container_remove (GTK_CONTAINER (getWidget()), (GtkWidget *) i->data);
g_list_free (children);
+ YDumbTab::deleteAllItems();
}
// to re-use the same widget in all tabs (m_fixed), we will remove and
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Mon May 5 19:06:23 2008
@@ -4,7 +4,6 @@
#include "ygdkmngloader.h"
#include
-#include
#include "YGUI.h"
#include "YGWidget.h"
#include "YImage.h"
Modified: trunk/gtk/src/YGInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGInputField.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGInputField.cc (original)
+++ trunk/gtk/src/YGInputField.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YInputField.h"
#include "YGWidget.h"
Modified: trunk/gtk/src/YGIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGIntField.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGIntField.cc (original)
+++ trunk/gtk/src/YGIntField.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
Modified: trunk/gtk/src/YGLabel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLabel.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGLabel.cc (original)
+++ trunk/gtk/src/YGLabel.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGUtils.h"
#include "YGWidget.h"
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
@@ -11,6 +10,8 @@
#include "YLayoutBox.h"
#include "ygtkratiobox.h"
#include "YSpacing.h"
+#include "YPushButton.h"
+#include "YMenuButton.h"
// GtkBox-like container (actually, more like our YGtkRatioBox)
class YGLayoutBox : public YLayoutBox, public YGWidget
@@ -18,7 +19,7 @@
// This group is meant to set all YGLabeledWidget with horizontal label
// to share the same width (if they belong to the same YSplit), so they
// look right
- GtkSizeGroup *m_labels_group;
+ GtkSizeGroup *m_labels_group, *m_buttons_group;
public:
YGLayoutBox (YWidget *parent, YUIDimension dim)
@@ -27,13 +28,15 @@
dim == YD_HORIZ ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL)
{
setBorder (0);
- m_labels_group = NULL;
+ m_labels_group = m_buttons_group = NULL;
}
~YGLayoutBox()
{
if (m_labels_group)
g_object_unref (G_OBJECT (m_labels_group));
+ if (m_buttons_group)
+ g_object_unref (G_OBJECT (m_buttons_group));
}
YGWIDGET_IMPL_CHILD_ADDED (getWidget())
@@ -66,6 +69,20 @@
ygtk_ratio_box_set_child_packing (box, child->getLayout(), ychild->stretchable (dim),
isLayoutStretch (ychild, dim), ychild->weight (dim), horiz_fill, vert_fill, 0);
+ // set all buttons to same height -- cause of stock icons...
+ if (dim == YD_HORIZ) {
+ bool isButton = false;
+ if (dynamic_cast (ychild))
+ isButton = true;
+ else if (dynamic_cast (ychild))
+ isButton = true;
+ if (isButton) {
+ if (!m_buttons_group)
+ m_buttons_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+ gtk_size_group_add_widget (m_buttons_group, child->getWidget());
+ }
+ }
+
// align horizontal widget labels to the same width
// we do some work here, since they may be placed inside a HBox or something...
if (dim == YD_HORIZ && !horiz_fill)
Modified: trunk/gtk/src/YGMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMenuButton.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGMenuButton.cc (original)
+++ trunk/gtk/src/YGMenuButton.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGUtils.h"
#include "YGWidget.h"
Modified: trunk/gtk/src/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Mon May 5 19:06:23 2008
@@ -4,11 +4,7 @@
#include
#include
-
-#define YUILogComponent "gtk-pkg"
-
#include "YGUI.h"
-#include "YUILog.h"
#include "YGUtils.h"
#include "YGi18n.h"
#include "YGDialog.h"
@@ -378,7 +374,7 @@
struct ListView : public View
{
bool m_isTree;
- ListView (bool isTree, PackagesView *parent)
+ ListView (bool isTree, bool showTooltips, PackagesView *parent)
: View (parent), m_isTree (isTree)
{
GtkTreeView *view = GTK_TREE_VIEW (m_widget = gtk_tree_view_new());
@@ -418,6 +414,8 @@
G_CALLBACK (popup_button_cb), this);
g_signal_connect_after (G_OBJECT (m_widget), "size-allocate",
G_CALLBACK (size_allocated_cb), this);
+ if (showTooltips)
+ gtk_tree_view_set_tooltip_column (view, YGtkZyppModel::PATTERN_DESCRIPTION_COLUMN);
}
virtual void setModel (GtkTreeModel *model)
@@ -480,6 +478,30 @@
GtkTreeView *view = GTK_TREE_VIEW (m_widget);
gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0, 0);
}
+
+#if 0
+ static gboolean query_tooltip_cb (GtkWidget *view, gint x, gint y,
+ gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data)
+ {
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
+ &x, &y, keyboard_mode, &model, &path, &iter)) {
+ gchar *tooltip_str;
+ gtk_tree_model_get (model, &iter, TOOLTIP_TEXT_COL,
+ &tooltip_str, -1);
+ gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view), tooltip, path);
+ gtk_tree_path_free (path);
+ if (tooltip_str) {
+ gtk_tooltip_set_text (tooltip, tooltip_str);
+ g_free (tooltip_str);
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+#endif
};
struct IconView : public View
{
@@ -590,7 +612,7 @@
gtk_container_remove (GTK_CONTAINER (m_bin), m_view->m_widget);
delete m_view;
if (mode == LIST_MODE)
- m_view = new ListView (m_isTree, this);
+ m_view = new ListView (m_isTree, m_isTree, this);
else
m_view = new IconView (this);
gtk_container_add (GTK_CONTAINER (m_bin), m_view->m_widget);
@@ -1449,8 +1471,11 @@
PackageControl (Filters *filters)
: m_filters (filters)
{
+ GtkWidget *box;
+
// installed
- m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE);
+ m_remove_button = createButton (NULL, GTK_STOCK_DELETE);
+ gtk_widget_set_tooltip_text (m_remove_button, _("Remove"));
g_signal_connect (G_OBJECT (m_remove_button), "clicked",
G_CALLBACK (remove_clicked_cb), this);
@@ -1458,11 +1483,16 @@
gtk_label_set_selectable (GTK_LABEL (m_installed_version), TRUE);
gtk_misc_set_alignment (GTK_MISC (m_installed_version), 0, 0.5);
- m_installed_box = gtk_vbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (m_installed_box), createBoldLabel (_("Installed:")),
+ box = gtk_vbox_new (FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (box), createBoldLabel (_("Installed:")),
FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_installed_box), m_installed_version, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_installed_box), m_remove_button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), m_installed_version, FALSE, TRUE, 0);
+
+ m_installed_box = gtk_hbox_new (FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (m_installed_box), box, TRUE, TRUE, 0);
+ box = gtk_alignment_new (0, 1, 0, 0);
+ gtk_container_add (GTK_CONTAINER (box), m_remove_button);
+ gtk_box_pack_start (GTK_BOX (m_installed_box), box, FALSE, TRUE, 0);
// available
m_install_button = createButton ("", GTK_STOCK_SAVE);
@@ -1683,10 +1713,16 @@
static GtkWidget *createButton (const char *label_str, const gchar *stock_id)
{
GtkWidget *button, *image;
- button = gtk_button_new_with_mnemonic (label_str);
+ if (label_str)
+ button = gtk_button_new_with_mnemonic (label_str);
+ else
+ button = gtk_button_new();
if (stock_id) {
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
- gtk_button_set_image (GTK_BUTTON (button), image);
+ if (label_str)
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ else
+ gtk_container_add (GTK_CONTAINER (button), image);
}
return button;
}
@@ -2222,8 +2258,8 @@
GtkWindow *window = YGDialog::currentWindow();
gtk_window_resize (window,
- MAX (700, GTK_WIDGET (window)->allocation.width),
- MAX (680, GTK_WIDGET (window)->allocation.height));
+ MAX (650, GTK_WIDGET (window)->allocation.width),
+ MAX (600, GTK_WIDGET (window)->allocation.height));
YGtkWizard *wizard = YGTK_WIZARD (getWidget());
ygtk_wizard_set_header_icon (wizard, window,
@@ -2303,14 +2339,14 @@
virtual bool acceptLicense (Ypp::Package *package, const std::string &license)
{
- std::string title = package->name() + _(" License Agreement");
- GtkWidget *dialog = gtk_dialog_new_with_buttons (title.c_str(),
- YGDialog::currentWindow(), GTK_DIALOG_NO_SEPARATOR,
- _("_Reject"), GTK_RESPONSE_REJECT, _("_Accept"), GTK_RESPONSE_ACCEPT, NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+ GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
+ (GtkDialogFlags) 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+ "%s %s", package->name().c_str(), _("License Agreement"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", _("Do you accept the terms of this license?"));
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
GtkWidget *license_view, *license_window;
-
license_view = ygtk_html_wrap_new();
ygtk_html_wrap_set_text (license_view, license.c_str(), FALSE);
@@ -2324,11 +2360,12 @@
GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
gtk_box_pack_start (vbox, license_window, TRUE, TRUE, 6);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 550, 450);
gtk_widget_show_all (dialog);
gint ret = gtk_dialog_run (GTK_DIALOG (dialog));
- bool confirmed = (ret == GTK_RESPONSE_ACCEPT);
+ bool confirmed = (ret == GTK_RESPONSE_YES);
gtk_widget_destroy (dialog);
return confirmed;
@@ -2383,34 +2420,11 @@
solution_toggled (model, path);
gtk_tree_path_free (path);
}
-#if 0
- static gboolean query_tooltip_cb (GtkWidget *view, gint x, gint y,
- gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data)
- {
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
- if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
- &x, &y, keyboard_mode, &model, &path, &iter)) {
- gchar *tooltip_str;
- gtk_tree_model_get (model, &iter, TOOLTIP_TEXT_COL,
- &tooltip_str, -1);
- gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view), tooltip, path);
- gtk_tree_path_free (path);
- if (tooltip_str) {
- gtk_tooltip_set_text (tooltip, tooltip_str);
- g_free (tooltip_str);
- return TRUE;
- }
- }
- return FALSE;
- }
-#endif
};
// model
GtkTreeStore *store = gtk_tree_store_new (8, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_POINTER);
+ G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
for (std::list ::iterator it = problems.begin();
it != problems.end(); it++) {
GtkTreeIter problem_iter;
Modified: trunk/gtk/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGProgressBar.cc (original)
+++ trunk/gtk/src/YGProgressBar.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGWidget.h"
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YPushButton.h"
#include "YGUtils.h"
@@ -56,8 +55,8 @@
g_object_unref (G_OBJECT (pixbuf));
}
else
- y2warning ("YGPushButton: Couldn't load icon image: %s.\n"
- "Reason: %s", path.c_str(), error->message);
+ yuiWarning() << "YGPushButton: Couldn't load icon image: " << path << endl
+ << "Reason: " << error->message << endl;
}
}
Modified: trunk/gtk/src/YGRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGRadioButton.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGRadioButton.cc (original)
+++ trunk/gtk/src/YGRadioButton.cc Mon May 5 19:06:23 2008
@@ -3,13 +3,10 @@
********************************************************************/
#include
-#include
#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
-#if 0
-//** Older approach:
// Sub-class GtkRadioButton to get a widget that renders like
// a radio-button, but behaves like a check/toggle-button.
static GType getCheckRadioButtonType()
@@ -33,7 +30,6 @@
klass_new->clicked = klass_sane->clicked;
return type;
}
-#endif
#include "YRadioButton.h"
#include "YRadioButtonGroup.h"
@@ -43,23 +39,18 @@
public:
YGRadioButton (YWidget *parent, const std::string &label, bool isChecked)
: YRadioButton (NULL, label),
- YGWidget (this, parent, true, GTK_TYPE_RADIO_BUTTON, NULL)
+ YGWidget (this, parent, true, getCheckRadioButtonType(), NULL)
{
IMPL
setBorder (0);
setLabel (label);
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), FALSE);
g_signal_connect_after (G_OBJECT (getWidget()), "toggled",
G_CALLBACK (toggled_cb), this);
}
- GSList *setGroup (GSList *group)
- {
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (getWidget()), group);
- return gtk_radio_button_get_group (GTK_RADIO_BUTTON (getWidget()));
- }
-
// YRadioButton
virtual void setLabel (const string &text)
{
@@ -80,11 +71,13 @@
virtual void setValue (bool checked)
{
IMPL
- if (checked) { // can't uncheck a radio button
- g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
- g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
+ if (checked) {
+ YRadioButton *yradio = static_cast (m_ywidget);
+ buttonGroup()->uncheckOtherButtons (yradio);
}
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
}
YGWIDGET_IMPL_COMMON
@@ -96,6 +89,7 @@
IMPL
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
pThis->emitEvent (YEvent::ValueChanged);
+ pThis->setValue (true);
}
};
@@ -114,33 +108,13 @@
return button;
}
-// YRadioButtonGroup
-
class YGRadioButtonGroup : public YRadioButtonGroup, public YGWidget
{
-GSList *group;
-
public:
YGRadioButtonGroup(YWidget *parent)
: YRadioButtonGroup (NULL),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
- {
- group = NULL;
- }
-
- virtual void addRadioButton (YRadioButton *_button)
- {
- YGRadioButton *button = (YGRadioButton *) YGWidget::get (_button);
- group = button->setGroup (group);
- YRadioButtonGroup::addRadioButton (_button);
- }
-
- virtual void removeRadioButton (YRadioButton *_button)
- {
- YGRadioButton *button = (YGRadioButton *) YGWidget::get (_button);
- button->setGroup (NULL);
- YRadioButtonGroup::removeRadioButton (_button);
- }
+ {}
YGWIDGET_IMPL_COMMON
YGWIDGET_IMPL_CHILD_ADDED (m_widget)
Modified: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (original)
+++ trunk/gtk/src/YGSelectionModel.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include
#include "YGSelectionModel.h"
Modified: trunk/gtk/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGUtils.h"
#include "YGWidget.h"
@@ -96,6 +95,8 @@
void setModel()
{ gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), getModel()); }
+ virtual bool immediateEvent() { return true; }
+
// YGSelectionModel
virtual void setFocusItem (GtkTreeIter *iter)
{
@@ -134,12 +135,10 @@
void blockEvents()
{
g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_cb, this);
- g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_delayed_cb, this);
}
void unblockEvents()
{
g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_cb, this);
- g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_delayed_cb, this);
}
// toggled by user (through clicking on the renderer or some other action)
@@ -154,21 +153,15 @@
gtk_tree_model_get (getModel(), &iter, column, &state, -1);
state = !state;
gtk_list_store_set (GTK_LIST_STORE (getModel()), &iter, column, state, -1);
-
- ((YSelectionWidget *) m_ywidget)->selectItem (getItem (&iter), state);
+ getItem (&iter)->setSelected (state);
emitEvent (YEvent::ValueChanged);
}
static void selected_cb (GtkTreeView *tree_view, YGTableView* pThis)
{
IMPL
- pThis->emitEvent (YEvent::SelectionChanged, true, true);
- }
-
- static void selected_delayed_cb (GtkTreeView *tree_view, YGTableView* pThis)
- {
- IMPL
- pThis->emitEvent (YEvent::SelectionChanged, true, true, false);
+ if (pThis->immediateEvent())
+ pThis->emitEvent (YEvent::SelectionChanged, true, true);
}
static void activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
@@ -216,9 +209,8 @@
g_signal_connect (G_OBJECT (getWidget()), "row-activated",
G_CALLBACK (activated_cb), (YGTableView*) this);
- if (immediateMode())
- g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_cb), (YGTableView*) this);
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
setSortable (true);
}
@@ -238,7 +230,7 @@
setCell (&iter, item->cell (i));
}
else
- y2error ("Can only add YTableItems to a YTable.");
+ yuiError() << "Can only add YTableItems to a YTable.\n";
YTable::addItem (_item);
}
@@ -271,6 +263,9 @@
g_list_free (columns);
}
+ virtual bool immediateEvent()
+ { return immediateMode(); }
+
YGWIDGET_IMPL_COMMON
YGSELECTION_WIDGET_IMPL_CLEAR (YTable)
YGSELECTION_WIDGET_IMPL_SELECT (YTable)
@@ -292,12 +287,8 @@
{
g_signal_connect (G_OBJECT (getWidget()), "row-activated",
G_CALLBACK (activated_cb), (YGTableView*) this);
- if (immediateMode())
- g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_cb), (YGTableView*) this);
- else
- g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_delayed_cb), (YGTableView*) this);
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
}
YGWIDGET_IMPL_COMMON
@@ -391,6 +382,7 @@
}
#include "YTree.h"
+#include "YTreeItem.h"
class YGTree : public YTree, public YGTableView
{
@@ -402,12 +394,12 @@
gtk_tree_view_set_enable_tree_lines (getView(), TRUE);
g_signal_connect (G_OBJECT (getWidget()), "row-activated",
G_CALLBACK (activated_cb), (YGTableView*) this);
- if (immediateMode())
- g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_cb), (YGTableView*) this);
- else
- g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_delayed_cb), (YGTableView*) this);
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
+ g_signal_connect (G_OBJECT (getWidget()), "row-collapsed",
+ G_CALLBACK (row_collapsed_cb), this);
+ g_signal_connect (G_OBJECT (getWidget()), "row-expanded",
+ G_CALLBACK (row_expanded_cb), this);
}
// YTree
@@ -435,6 +427,23 @@
gtk_tree_path_free (path);
}
+ // callbacks
+ void setRowOpen (GtkTreeIter *iter, bool open)
+ {
+ YTreeItem *item = static_cast (getItem (iter));
+ item->setOpen (open);
+ }
+ static void row_collapsed_cb (GtkTreeView *view, GtkTreeIter *iter,
+ GtkTreePath *path, YGTree *pThis)
+ {
+ pThis->setRowOpen (iter, false);
+ }
+ static void row_expanded_cb (GtkTreeView *view, GtkTreeIter *iter,
+ GtkTreePath *path, YGTree *pThis)
+ {
+ pThis->setRowOpen (iter, true);
+ }
+
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YTree)
YGSELECTION_WIDGET_IMPL_CLEAR (YTree)
Added: trunk/gtk/src/YGTextView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTextView.cc?rev=47297&view=auto
==============================================================================
--- trunk/gtk/src/YGTextView.cc (added)
+++ trunk/gtk/src/YGTextView.cc Mon May 5 19:06:23 2008
@@ -0,0 +1,237 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include <string>
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+class YGTextView : public YGScrolledWidget
+{
+int maxChars;
+
+public:
+ YGTextView (YWidget *ywidget, YWidget *parent, const string &label, bool editable)
+ : YGScrolledWidget (ywidget, parent, label, YD_VERT, true,
+ GTK_TYPE_TEXT_VIEW, "wrap-mode", GTK_WRAP_WORD, NULL)
+ {
+ IMPL
+ setMinSizeInChars (20, 10);
+ setPolicy (GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+
+ maxChars = -1;
+ if (!editable)
+ {
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (getWidget()), FALSE);
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (getWidget()), FALSE);
+ }
+
+ g_signal_connect (G_OBJECT (getBuffer()), "changed",
+ G_CALLBACK (text_changed_cb), this);
+ }
+
+ GtkTextBuffer* getBuffer()
+ { return gtk_text_view_get_buffer (GTK_TEXT_VIEW (getWidget())); }
+
+ int getCharsNb()
+ {
+ IMPL
+ return gtk_text_buffer_get_char_count (getBuffer());
+ }
+
+ void setCharsNb (int max_chars)
+ {
+ IMPL
+ maxChars = max_chars;
+ if (maxChars != -1 && getCharsNb() > maxChars)
+ truncateText (maxChars);
+ }
+
+ void truncateText(int pos)
+ {
+ IMPL
+ GtkTextIter start_it, end_it;
+ gtk_text_buffer_get_iter_at_offset (getBuffer(), &start_it, pos);
+ gtk_text_buffer_get_end_iter (getBuffer(), &end_it);
+
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) text_changed_cb, this);
+ gtk_text_buffer_delete (getBuffer(), &start_it, &end_it);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) text_changed_cb, this);
+ }
+
+ void setText (const string &text)
+ {
+ IMPL
+ gtk_text_buffer_set_text (getBuffer(), text.c_str(), -1);
+ }
+
+ string getText()
+ {
+ IMPL
+ GtkTextIter start_it, end_it;
+ gtk_text_buffer_get_bounds (getBuffer(), &start_it, &end_it);
+
+ gchar* text = gtk_text_buffer_get_text (getBuffer(), &start_it, &end_it, FALSE);
+ string str (text);
+ g_free (text);
+ return str;
+ }
+
+ void scrollToBottom()
+ {
+ YGUtils::scrollWidget (GTK_TEXT_VIEW (getWidget()), false);
+ }
+
+ // Event callbacks
+ static void text_changed_cb (GtkTextBuffer *buffer, YGTextView *pThis)
+ {
+ if (pThis->maxChars != -1 && pThis->getCharsNb() > pThis->maxChars) {
+ pThis->truncateText (pThis->maxChars);
+ gdk_beep();
+ }
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+};
+
+#include "YMultiLineEdit.h"
+
+class YGMultiLineEdit : public YMultiLineEdit, public YGTextView
+{
+public:
+ YGMultiLineEdit (YWidget *parent, const string &label)
+ : YMultiLineEdit (NULL, label)
+ , YGTextView (this, parent, label, true)
+ {}
+
+ // YMultiLineEdit
+ virtual void setValue (const string &text)
+ { YGTextView::setText (text); }
+
+ virtual string value()
+ { return YGTextView::getText(); }
+
+ virtual void setInputMaxLength (int nb)
+ {
+ YGTextView::setCharsNb (nb);
+ YMultiLineEdit::setInputMaxLength (nb);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YMultiLineEdit)
+};
+
+YMultiLineEdit *YGWidgetFactory::createMultiLineEdit (YWidget *parent, const string &label)
+{
+ return new YGMultiLineEdit (parent, label);
+}
+
+#include "YLogView.h"
+
+class YGLogView : public YLogView, public YGTextView
+{
+public:
+ YGLogView (YWidget *parent, const string &label, int visibleLines, int maxLines)
+ : YLogView (NULL, label, visibleLines, maxLines)
+ , YGTextView (this, parent, label, false)
+ {}
+
+ // YLogView
+ virtual void displayLogText (const string &text)
+ {
+ setText (text);
+ scrollToBottom();
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YLogView)
+};
+
+YLogView *YGWidgetFactory::createLogView (YWidget *parent, const string &label,
+ int visibleLines, int maxLines)
+{
+ return new YGLogView (parent, label, visibleLines, maxLines);
+}
+
+#include "YRichText.h"
+#include "ygtkhtmlwrap.h"
+
+class YGRichText : public YRichText, YGScrolledWidget
+{
+public:
+ YGRichText (YWidget *parent, const string &text, bool plainText)
+ : YRichText (NULL, text, plainText)
+ , YGScrolledWidget (this, parent, true, ygtk_html_wrap_get_type(), NULL)
+ {
+ IMPL
+ if (!shrinkable())
+ setMinSizeInChars (20, 8);
+
+ ygtk_html_wrap_init (getWidget());
+ ygtk_html_wrap_connect_link_clicked (getWidget(), G_CALLBACK (link_clicked_cb), this);
+ setText (text, plainText);
+ }
+
+ void setPlainText (const string &text)
+ {
+ ygtk_html_wrap_set_text (getWidget(), text.c_str(), TRUE);
+ }
+
+ void setRichText (const string &_text)
+ {
+ string text (_text);
+ std::string productName = YUI::app()->productName();
+ YGUtils::replace (text, "&product;", 9, productName.c_str());
+ ygtk_html_wrap_set_text (getWidget(), text.c_str(), FALSE);
+ }
+
+ void scrollToBottom()
+ {
+ ygtk_html_wrap_scroll (getWidget(), FALSE);
+ }
+
+ void setText (const string &text, bool plain_mode)
+ {
+ plain_mode ? setPlainText (text) : setRichText (text);
+ if (autoScrollDown())
+ scrollToBottom();
+ }
+
+ // YRichText
+ virtual void setValue (const string &text)
+ {
+ IMPL
+ setText (text, plainTextMode());
+ YRichText::setValue (text);
+ }
+
+ virtual void setAutoScrollDown (bool on)
+ {
+ if (on) scrollToBottom();
+ YRichText::setAutoScrollDown (on);
+ }
+
+ virtual void setPlainTextMode (bool plain_mode)
+ {
+ if (plain_mode != plainTextMode())
+ setText (value(), plain_mode);
+ YRichText::setPlainTextMode (plain_mode);
+ }
+
+ // events
+ static void link_clicked_cb (GtkWidget *widget, const char *url, YGRichText *pThis)
+ {
+ YGUI::ui()->sendEvent (new YMenuEvent (url));
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+
+YRichText *YGWidgetFactory::createRichText (YWidget *parent, const string &text,
+ bool plainTextMode)
+{
+ return new YGRichText (parent, text, plainTextMode);
+}
+
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Mon May 5 19:06:23 2008
@@ -3,10 +3,10 @@
********************************************************************/
#include
+#include
#include
#include
#include
-#include
#include
#include
#include
@@ -250,17 +250,17 @@
YEvent *YGUI::runPkgSelection (YWidget *packageSelector)
{
- y2milestone( "Running package selection..." );
+ yuiMilestone() << "Running package selection...\n";
YEvent *event = 0;
try {
event = packageSelector->findDialog()->waitForEvent();
} catch (const std::exception &e) {
- y2error ("UI::RunPkgSelection() error: %s", e.what());
- y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
+ yuiError() << "UI::RunPkgSelection() error: " << e.what() << endl;
+ yuiError() << "This is a libzypp problem. Do not file a bug against the UI!\n";
} catch (...) {
- y2error ("UI::RunPkgSelection() error (unspecified)");
- y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
+ yuiError() << "UI::RunPkgSelection() error (unspecified)\n";
+ yuiError() << "This is a libzypp problem. Do not file a bug against the UI!\n";
}
return event;
}
@@ -303,15 +303,15 @@
if (!filename.empty()) {
std::string command = "/sbin/save_y2logs";
command += " '" + filename + "'";
- y2milestone ("Saving y2logs: %s", command.c_str());
+ yuiMilestone() << "Saving y2logs: " << command << endl;
int ret = system (command.c_str());
if (ret == 0)
- y2milestone ("y2logs saved to %s", filename.c_str());
+ yuiMilestone() << "y2logs saved to " << filename << endl;
else {
char *error = g_strdup_printf (
"Error: couldn't save y2logs: \"%s\" (exit value: %d)",
command.c_str(), ret);
- y2error ("%s", error);
+ yuiError() << error << endl;
errorMsg (error);
g_free (error);
}
@@ -383,12 +383,12 @@
filename = tmp_name;
g_free (tmp_name);
}
- y2debug ("screenshot: %s", filename.c_str());
+ yuiDebug() << "screenshot: " << filename << endl;
filename = askForFileOrDirectory (
GTK_FILE_CHOOSER_ACTION_SAVE, "", "*.png", "Save screenshot to");
if (filename.empty()) { // user dismissed the dialog
- y2debug ("Save screen shot canceled by user");
+ yuiDebug() << "Save screen shot canceled by user\n";
goto makeScreenShot_ret;
}
@@ -396,9 +396,9 @@
screenShotNb[baseName] = nb + 1;
}
- y2debug ("Saving screen shot to %s", filename.c_str());
+ yuiDebug() << "Saving screen shot to " << filename << endl;
if (gdk_pixbuf_save (shot, filename.c_str(), "png", &error, NULL)) {
- y2error ("Couldn't save screen shot %s", filename.c_str());
+ yuiError() << "Couldn't save screen shot " << filename << endl;
if (interactive) {
string msg = "Couldn't save screenshot to file " + filename
+ " - " + error->message;
@@ -437,9 +437,9 @@
string dirname, filename;
if (!path.empty()) {
if (path[0] != '/')
- y2warning ("FileDialog: Relative paths are unsupported: '%s'", path.c_str());
+ yuiWarning() << "FileDialog: Relative paths are unsupported: '" << path << "'\n";
else if (!g_file_test (path.c_str(), G_FILE_TEST_EXISTS))
- y2warning ("FileDialog: Path doesn't exist: '%s'", path.c_str());
+ yuiWarning() << "FileDialog: Path doesn't exist: '" << path << "'\n";
else if (g_file_test (path.c_str(), G_FILE_TEST_IS_DIR))
dirname = path;
else { // its a file
Modified: trunk/gtk/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Mon May 5 19:06:23 2008
@@ -9,6 +9,9 @@
#include
#include <map>
+#define YUILogComponent "gtk"
+#include
+
#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
/* Comment the following line to disable debug messages */
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,7 @@
********************************************************************/
#include
-#include
+#include
#include "YGUI.h"
#include "YGUtils.h"
@@ -50,15 +50,19 @@
}
};
+ if (g_object_get_data (G_OBJECT (entry), "insert-text-set"))
+ g_object_disconnect (G_OBJECT (entry), "insert-text",
+ G_CALLBACK (inner::insert_text_cb), NULL);
+
if (!validChars.empty()) {
gchar *chars = g_strdup (validChars.c_str());
g_object_set_data_full (G_OBJECT (entry), "valid-chars", chars, g_free);
g_signal_connect (G_OBJECT (entry), "insert-text",
G_CALLBACK (inner::insert_text_cb), NULL);
+ g_object_set_data (G_OBJECT (entry), "insert-text-set", GINT_TO_POINTER (1));
}
else
- g_object_disconnect (G_OBJECT (entry), "insert-text",
- G_CALLBACK (inner::insert_text_cb), NULL);
+ g_object_set_data (G_OBJECT (entry), "insert-text-set", GINT_TO_POINTER (0));
}
void ygutils_setFilter (GtkEntry *entry, const char *validChars)
@@ -93,9 +97,17 @@
gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size);
}
-void YGUtils::scrollWidget (GtkTextView *text_view, bool top)
+void YGUtils::scrollWidget (GtkTextView *view, bool top)
{
- scrollWidget (text_view->vadjustment, top);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+ GtkTextIter iter;
+ gtk_text_buffer_get_end_iter (buffer, &iter);
+ GtkTextMark *mark = gtk_text_buffer_get_mark (buffer, "scroll");
+ if (mark)
+ gtk_text_buffer_move_mark (buffer, mark, &iter);
+ else
+ mark = gtk_text_buffer_create_mark (buffer, "scroll", &iter, FALSE);
+ gtk_text_view_scroll_mark_onscreen (view, mark);
}
void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top)
@@ -403,7 +415,6 @@
{
PangoFontDescription *font_desc = widget->style->font_desc;
int size = pango_font_description_get_size (font_desc);
-
PangoFontDescription* font = pango_font_description_new();
pango_font_description_set_weight (font, weight);
pango_font_description_set_size (font, (int)(size * scale));
@@ -441,8 +452,8 @@
GError *error = 0;
pixbuf = gdk_pixbuf_new_from_file (filename.c_str(), &error);
if (!pixbuf)
- y2warning ("Could not load icon: %s.\nReason: %s\n",
- filename.c_str(), error->message);
+ yuiWarning() << "Could not load icon: " << filename << "\n"
+ "Reason: " << error->message << "\n";
}
return pixbuf;
}
@@ -459,6 +470,7 @@
{"Apply", GTK_STOCK_APPLY },
{"Back", GTK_STOCK_GO_BACK },
{"Cancel", GTK_STOCK_CANCEL },
+ {"Close", GTK_STOCK_CLOSE },
{"Configure", GTK_STOCK_PREFERENCES },
{"Continue", GTK_STOCK_OK },
{"Delete", GTK_STOCK_DELETE },
Modified: trunk/gtk/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGWidget.cc (original)
+++ trunk/gtk/src/YGWidget.cc Mon May 5 19:06:23 2008
@@ -55,6 +55,7 @@
IMPL
gtk_widget_destroy (m_adj_size);
g_object_unref (G_OBJECT (m_adj_size));
+ // remove all children if container?
}
void YGWidget::show()
Modified: trunk/gtk/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWizard.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/YGWizard.cc (original)
+++ trunk/gtk/src/YGWizard.cc Mon May 5 19:06:23 2008
@@ -3,7 +3,6 @@
********************************************************************/
#include
-#include
#include
#include "YGWidget.h"
#include "YGUtils.h"
@@ -51,8 +50,11 @@
}
void setEnabled (bool enable) {
- gtk_widget_set_sensitive (m_widget, enable);
- YWidget::setEnabled (enable);
+ if (isEnabled() != enable) {
+ gtk_widget_set_sensitive (m_widget, enable);
+ YWidget::setEnabled (enable);
+ setLabel (label()); // re-load stock icon for new state
+ }
}
int preferredWidth() { return 0; }
@@ -94,8 +96,8 @@
bool steps_enabled = wizardMode == YWizardMode_Steps;
bool tree_enabled = wizardMode == YWizardMode_Tree;
if (steps_enabled && tree_enabled) {
- y2error ("YGWizard doesn't support both steps and tree enabled at the "
- "same time.\nDisabling the steps...");
+ yuiError() << "YGWizard doesn't support both steps and tree enabled at the "
+ "same time.\nDisabling the steps...\n";
steps_enabled = false;
}
if (steps_enabled)
@@ -151,7 +153,7 @@
{
if (!ygtk_wizard_set_header_icon (getWizard(), YGDialog::currentWindow(),
icon.c_str()))
- y2warning ("YGWizard: could not load image: %s", icon.c_str());
+ yuiWarning() << "YGWizard: could not load image: " << icon << endl;
}
virtual void setDialogHeading (const string &heading)
@@ -178,7 +180,7 @@
virtual void setCurrentStep (const string &id)
{
if (!ygtk_wizard_set_current_step (getWizard(), id.c_str()))
- y2error ("YGWizard: there is no step with id %s.", id.c_str());
+ yuiError() << "YGWizard: there is no step with id " << id << endl;
}
virtual void updateSteps()
@@ -189,14 +191,13 @@
{
if (!ygtk_wizard_add_tree_item (getWizard(), parentID.c_str(),
text.c_str(), id.c_str()))
- y2error ("YGWizard: there is no tree item with id '%s'",
- parentID.c_str());
+ yuiError() << "YGWizard: there is no tree item with id " << parentID << endl;
}
virtual void selectTreeItem (const string &id)
{
if (!ygtk_wizard_select_tree_item (getWizard(), id.c_str()))
- y2error ("YGWizard: there is no tree item with id '%s'", id.c_str());
+ yuiError() << "YGWizard: there is no tree item with id " << id << endl;
}
virtual string currentTreeSelection()
@@ -224,8 +225,7 @@
string str = YGUtils::mapKBAccel(text);
if (!ygtk_wizard_add_sub_menu (getWizard(), parentID.c_str(), str.c_str(),
id.c_str()))
- y2error ("YGWizard: there is no menu item with id '%s'",
- parentID.c_str());
+ yuiError() << "YGWizard: there is no menu item with id " << parentID << endl;
}
virtual void addMenuEntry (const string &parentID, const string &text,
@@ -234,15 +234,13 @@
string str = YGUtils::mapKBAccel (text);
if (!ygtk_wizard_add_menu_entry (getWizard(), parentID.c_str(),
str.c_str(), id.c_str()))
- y2error ("YGWizard: there is no menu item with id '%s'",
- parentID.c_str());
+ yuiError() << "YGWizard: there is no menu item with id " << parentID << endl;
}
virtual void addMenuSeparator (const string & parentID)
{
if (!ygtk_wizard_add_menu_separator (getWizard(), parentID.c_str()))
- y2error ("YGWizard: there is no menu item with id '%s'",
- parentID.c_str());
+ yuiError() << "YGWizard: there is no menu item with id " << parentID << endl;
}
virtual void deleteMenus()
Modified: trunk/gtk/src/ygtkratiobox.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/ygtkratiobox.c (original)
+++ trunk/gtk/src/ygtkratiobox.c Mon May 5 19:06:23 2008
@@ -164,6 +164,12 @@
requisition->width = secondary_req;
requisition->height = primary_req;
}
+
+ // hack for bug #373159 -- we'll want to use the new layout stuff to
+ // get nice window default sizes, and eliminate the minSize hacks
+ #define MAX_SIZE 400
+ requisition->width = MIN (MAX_SIZE, requisition->width);
+ requisition->height = MIN (MAX_SIZE, requisition->height);
}
static void ygtk_ratio_box_size_allocate (GtkWidget *widget,
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Mon May 5 19:06:23 2008
@@ -24,14 +24,17 @@
double scale);
extern void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str);
-static void label_style_set_cb (GtkWidget *widget, GtkStyle *prev_style)
+static void set_label_header_cb (GtkWidget *label, GtkStyle *prev_style, gpointer psize)
{
- static gboolean safeguard = FALSE;
- if (safeguard) return;
- safeguard = TRUE;
- gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &widget->style->fg [GTK_STATE_SELECTED]);
- ygutils_setWidgetFont (widget, PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_LARGE);
- safeguard = FALSE;
+ if (prev_style) return;
+ double size = psize == 0 ? PANGO_SCALE_LARGE : PANGO_SCALE_XX_LARGE;
+ gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &label->style->fg [GTK_STATE_SELECTED]);
+ ygutils_setWidgetFont (label, PANGO_WEIGHT_ULTRABOLD, size);
+}
+static void set_label_header (GtkWidget *label, int size)
+{
+ g_signal_connect (G_OBJECT (label), "style-set",
+ G_CALLBACK (set_label_header_cb), GINT_TO_POINTER (size));
}
//** YGtkHelpDialog
@@ -84,8 +87,7 @@
dialog->title_image = gtk_image_new_from_stock (GTK_STOCK_HELP,
GTK_ICON_SIZE_LARGE_TOOLBAR);
dialog->title_label = gtk_label_new ("Help");
- g_signal_connect (G_OBJECT (dialog->title_label), "style-set",
- G_CALLBACK (label_style_set_cb), NULL);
+ set_label_header (dialog->title_label, 0);
gtk_box_pack_start (GTK_BOX (dialog->title_box), dialog->title_image,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (dialog->title_box), dialog->title_label,
@@ -327,17 +329,9 @@
wizard->m_title_image = gtk_image_new();
wizard->m_title_label = gtk_label_new("");
- g_signal_connect (G_OBJECT (wizard->m_title_label), "style-set",
- G_CALLBACK (label_style_set_cb), NULL);
gtk_label_set_ellipsize (GTK_LABEL (wizard->m_title_label), PANGO_ELLIPSIZE_END);
gtk_misc_set_alignment (GTK_MISC (wizard->m_title_label), 0, 0.5);
-
- // setup label look
- gtk_widget_modify_fg (wizard->m_title_label, GTK_STATE_NORMAL,
- &wizard->m_title_label->style->fg [GTK_STATE_SELECTED]);
- // set a strong font to the heading label
- ygutils_setWidgetFont (wizard->m_title_label, PANGO_WEIGHT_ULTRABOLD,
- PANGO_SCALE_XX_LARGE);
+ set_label_header (wizard->m_title_label, 1);
gtk_box_pack_start (GTK_BOX (wizard->m_title), wizard->m_title_label,
TRUE, TRUE, 0);
Modified: trunk/gtk/src/ygtkzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.cc (original)
+++ trunk/gtk/src/ygtkzyppwrapper.cc Mon May 5 19:06:23 2008
@@ -232,6 +232,7 @@
return GDK_TYPE_PIXBUF;
case YGtkZyppModel::NAME_COLUMN:
case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
+ case YGtkZyppModel::PATTERN_DESCRIPTION_COLUMN:
return G_TYPE_STRING;
case YGtkZyppModel::PTR_COLUMN:
return G_TYPE_POINTER;
@@ -243,7 +244,8 @@
gint column, GValue *value)
{
YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
- Ypp::Package *package = zmodel->pool->get (iter->user_data);
+ Ypp::Pool::Iter pool_iter = iter->user_data;
+ Ypp::Package *package = zmodel->pool->get (pool_iter);
g_value_init (value, ygtk_zypp_model_get_column_type (model, column));
@@ -306,12 +308,23 @@
}
case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
{
+ bool highlight = zmodel->pool->highlight (pool_iter);
std::string str = package->name();
+/* if (highlight)
+ str = "" + str + "</span>";*/
std::string summary = package->summary();
if (!summary.empty()) {
YGUtils::escapeMarkup (summary);
str += "\n<small>" + summary + "</small>";
}
+ if (highlight)
+ str = "<b>" + str + "</b>";
+ g_value_set_string (value, g_strdup (str.c_str()));
+ break;
+ }
+ case YGtkZyppModel::PATTERN_DESCRIPTION_COLUMN:
+ {
+ std::string str (package->description());
g_value_set_string (value, g_strdup (str.c_str()));
break;
}
@@ -322,8 +335,7 @@
g_value_set_pointer (value, ptr);
break;
}
- default:
- g_warning ("YGtkZyppModel column %d doesn't exist.", column);
+ case YGtkZyppModel::TOTAL_COLUMNS:
break;
}
}
Modified: trunk/gtk/src/ygtkzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.h?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.h (original)
+++ trunk/gtk/src/ygtkzyppwrapper.h Mon May 5 19:06:23 2008
@@ -26,7 +26,8 @@
GObject parent;
enum Columns {
- ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN, PTR_COLUMN, TOTAL_COLUMNS
+ ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN,
+ PATTERN_DESCRIPTION_COLUMN, PTR_COLUMN, TOTAL_COLUMNS
};
Ypp::Pool *pool;
Modified: trunk/gtk/src/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Mon May 5 19:06:23 2008
@@ -10,10 +10,10 @@
#include "yzyppwrapper.h"
#include
#include <string>
-
+#include <sstream>
#define YUILogComponent "gtk-pkg"
-
#include
+
#include
#include
#include
@@ -29,8 +29,6 @@
#include
#include "YGUtils.h"
-//#define OLD_ZYPP
-
//** Zypp shortcuts
typedef zypp::ResPoolProxy ZyppPool;
@@ -188,6 +186,21 @@
ZyppObject installed = zyppSel->installedObj();
if (!!candidate && !!installed)
hasUpgrade = zypp::Edition::compare (candidate->edition(), installed->edition()) > 0;
+
+ packagesCache = NULL;
+ if (type == PATTERN_TYPE) {
+ isPatternInstalled = true;
+ ZyppObject object = sel->theObj();
+ ZyppPattern pattern = tryCastToZyppPattern (object);
+ zypp::Pattern::Contents contents (pattern->contents());
+ for (zypp::Pattern::Contents::Selectable_iterator it =
+ contents.selectableBegin(); it != contents.selectableEnd(); it++) {
+ packagesCache = g_slist_append (packagesCache, get_pointer (*it));
+ if ((*it)->installedEmpty())
+ isPatternInstalled = false;
+ }
+ }
+
setUnmodified();
}
@@ -197,6 +210,7 @@
for (GSList *i = availableVersions; i; i = i->next)
delete ((Version *) i->data);
g_slist_free (availableVersions);
+ g_slist_free (packagesCache);
}
inline bool isModified()
@@ -212,6 +226,9 @@
Version *installedVersion;
bool hasUpgrade;
zypp::ui::Status curStatus; // so we know if resolver touched it
+ // for patterns only:
+ bool isPatternInstalled;
+ GSList *packagesCache;
};
Ypp::Package::Package (Ypp::Package::Impl *impl)
@@ -260,43 +277,66 @@
{
ZyppObject object = impl->zyppSel->theObj();
std::string text = object->description(), br = "<br>";
- // if it has this header, then it is HTML
- const char *header = "<!-- DT:Rich -->", header_len = 16;
- if (!text.compare (0, header_len, header, header_len))
- ;
- else {
- // cut authors block
- std::string::size_type i = text.find ("\nAuthors:", 0);
- if (i != std::string::npos) {
- int j = i + sizeof ("\nAuthors:\n");
- if (text.compare (j, sizeof ("-----"), "-----")) {
- text.erase (i);
- }
- }
- while (text.length() > 0 && text [text.length()-1] == '\n')
- text.erase (text.length()-1);
+ switch (impl->type) {
+ case PACKAGE_TYPE:
+ {
+ // if it has this header, then it is HTML
+ const char *header = "<!-- DT:Rich -->", header_len = 16;
- YGUtils::escapeMarkup (text);
- YGUtils::replace (text, "\n\n", 2, "<br>"); // break every double line
- text += "<br>";
- }
+ if (!text.compare (0, header_len, header, header_len))
+ ;
+ else {
+ // cut authors block
+ std::string::size_type i = text.find ("\nAuthors:", 0);
+ if (i != std::string::npos) {
+ int j = i + sizeof ("\nAuthors:\n");
+ if (text.compare (j, sizeof ("-----"), "-----")) {
+ text.erase (i);
+ }
+ }
+ while (text.length() > 0 && text [text.length()-1] == '\n')
+ text.erase (text.length()-1);
- if (impl->type == PACKAGE_TYPE) {
- ZyppPackage package = tryCastToZyppPkg (object);
- std::string url = package->url(), license = package->license();
- if (!url.empty())
- text += br + "<b>" + _("Website:") + "</b> " + url;
- if (!license.empty())
- text += br + "<b>" + _("License:") + "</b> " + license;
- }
- else if (impl->type == PATCH_TYPE) {
- ZyppPatch patch = tryCastToZyppPatch (object);
- if (patch->reboot_needed())
- text += br + br + "<b>" + _("Reboot needed!") + "</b>";
+ YGUtils::escapeMarkup (text);
+ YGUtils::replace (text, "\n\n", 2, "<br>"); // break every double line
+ text += "<br>";
+ }
+
+ // specific
+ ZyppPackage package = tryCastToZyppPkg (object);
+ std::string url = package->url(), license = package->license();
+ if (!url.empty())
+ text += br + "<b>" + _("Website:") + "</b> " + url;
+ if (!license.empty())
+ text += br + "<b>" + _("License:") + "</b> " + license;
+ text += br + "<b>" + _("Size:") + "</b> " + object->installsize().asString() + "B";
+ break;
+ }
+ case PATCH_TYPE:
+ {
+ ZyppPatch patch = tryCastToZyppPatch (object);
+ if (patch->rebootSuggested())
+ text += br + br + "<b>" + _("Reboot needed!") + "</b>";
+ break;
+ }
+ case PATTERN_TYPE:
+ {
+ int installed = 0, total = 0;
+ for (GSList *i = impl->packagesCache; i; i = i->next) {
+ ZyppSelectablePtr sel = (ZyppSelectablePtr) i->data;
+ if (!sel->installedEmpty())
+ installed++;
+ total++;
+ }
+ std::ostringstream stream;
+ stream << "\n\n" << installed << " / " << total;
+ text += stream.str();
+ break;
+ }
+ default:
+ break;
}
- if (impl->type != PATCH_TYPE)
- text += br + "<b>" + _("Size:") + "</b> " + object->size().asString() + "B";
return text;
}
@@ -431,15 +471,9 @@
{
std::string text;
ZyppObject object = impl->zyppSel->theObj();
-#ifdef OLD_ZYPP
- const zypp::CapSet &capSet = object->dep (zypp::Dep::PROVIDES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++) {
-#else
const zypp::Capabilities &capSet = object->dep (zypp::Dep::PROVIDES);
for (zypp::Capabilities::const_iterator it = capSet.begin();
it != capSet.end(); it++) {
-#endif
if (!text.empty())
text += "\n";
text += it->asString();
@@ -451,15 +485,9 @@
{
std::string text;
ZyppObject object = impl->zyppSel->theObj();
-#ifdef OLD_ZYPP
- const zypp::CapSet &capSet = object->dep (zypp::Dep::REQUIRES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++) {
-#else
const zypp::Capabilities &capSet = object->dep (zypp::Dep::REQUIRES);
for (zypp::Capabilities::const_iterator it = capSet.begin();
it != capSet.end(); it++) {
-#endif
if (!text.empty())
text += "\n";
text += it->asString();
@@ -477,17 +505,31 @@
switch (collection->type()) {
case Ypp::Package::PATTERN_TYPE:
{
+//fprintf (stderr, "check if package %s is from collection %s\n", name().c_str(), collection->name().c_str());
+#if 0
ZyppSelectable selectable = collection->impl->zyppSel;
ZyppObject object = selectable->theObj();
ZyppPattern pattern = tryCastToZyppPattern (object);
- zypp::ui::PatternContents contents (pattern);
- const std::set std::string &packages = contents.install_packages();
- for (std::set std::string::iterator it = packages.begin();
- it != packages.end(); it++) {
- if (this->impl->zyppSel->name() == *it)
+ zypp::Pattern::Contents contents (pattern->contents());
+ for (zypp::Pattern::Contents::Selectable_iterator it =
+ contents.selectableBegin(); it != contents.selectableEnd(); it++) {
+// ZyppPackage pkg = tryCastToZyppPkg ((*it)->theObj());
+// if (this->impl->zyppSel->name() == pkg->name()) {
+if (this->impl->zyppSel == *it) {
+//fprintf (stderr, "return true\n");
return true;
+ }
}
+#endif
+
+ for (GSList *i = collection->impl->packagesCache; i; i = i->next) {
+ if (this->impl->zyppSel == i->data)
+ return true;
+ }
+ return false;
+
+//fprintf (stderr, "return false\n");
break;
}
#if 0
@@ -514,15 +556,20 @@
bool Ypp::Package::isInstalled()
{
- if (impl->type == Ypp::Package::PATCH_TYPE) {
- if (impl->zyppSel->hasInstalledObj()) {
- // broken? show as available
- if (impl->zyppSel->installedPoolItem().isBroken())
- return false;
- }
+ switch (impl->type) {
+ case Ypp::Package::PATCH_TYPE:
+ if (!impl->zyppSel->installedEmpty()) {
+ // broken? show as available
+ if (impl->zyppSel->installedObj().isBroken())
+ return false;
+ }
+ break;
+ case Ypp::Package::PATTERN_TYPE:
+ return impl->isPatternInstalled;
+ default:
+ break;
}
-
- return impl->zyppSel->hasInstalledObj();
+ return !impl->zyppSel->installedEmpty();
}
bool Ypp::Package::hasUpgrade()
@@ -608,7 +655,7 @@
break;
}
- impl->zyppSel->set_status (status);
+ impl->zyppSel->setStatus (status);
if (toInstall()) {
const Version *version = getAvailableVersion (nb);
ZyppObject candidate = (ZyppObjectPtr) version->impl;
@@ -649,7 +696,7 @@
break;
}
- impl->zyppSel->set_status (status);
+ impl->zyppSel->setStatus (status);
ypp->impl->packageModified (this);
}
@@ -683,7 +730,7 @@
break;
}
- impl->zyppSel->set_status (status);
+ impl->zyppSel->setStatus (status);
ypp->impl->packageModified (this);
}
@@ -697,7 +744,7 @@
else
status = isInstalled() ? zypp::ui::S_KeepInstalled : zypp::ui::S_NoInst;
- impl->zyppSel->set_status (status);
+ impl->zyppSel->setStatus (status);
ypp->impl->packageModified (this);
}
@@ -706,11 +753,7 @@
Ypp::Package::Version *version = new Ypp::Package::Version();
version->number = object->edition().asString();
version->number += " (" + object->arch().asString() + ")";
-#ifdef OLD_ZYPP
- version->repo = ypp->impl->getRepository (object->repository().info().alias());
-#else
version->repo = ypp->impl->getRepository (object->repoInfo().alias());
-#endif
version->cmp = 0;
version->impl = (void *) get_pointer (object);
return version;
@@ -834,9 +877,12 @@
Key <bool> isInstalled;
Key <bool> hasUpgrade;
Key <bool> isModified;
+ Ypp::Package *highlight;
Impl()
- {}
+ {
+ highlight = NULL;
+ }
bool match (Package *package)
{
@@ -866,6 +912,18 @@
break;
}
}
+
+ if (match && !highlight) {
+ bool full_match = true;
+ std::list std::string::const_iterator it;
+ for (it = values.begin(); it != values.end(); it++)
+ if (package->name() != *it) {
+ full_match = false;
+ break;
+ }
+ if (full_match)
+ highlight = package;
+ }
}
if (match && categories.defined) {
Ypp::Node *pkg_category = package->category();
@@ -1094,6 +1152,9 @@
Ypp::Package *Ypp::QueryPool::get (Ypp::Pool::Iter iter)
{ return (Ypp::Package *) ((GSList *) iter)->data; }
+bool Ypp::QueryPool::highlight (Ypp::Pool::Iter iter)
+{ return impl->query->impl->highlight == get (iter); }
+
//** TreePool
struct Ypp::TreePool::Impl : public Ypp::Pool::Impl
@@ -1567,8 +1628,8 @@
ZyppPatch patch = tryCastToZyppPatch (object);
if (!patch)
continue;
- if (!(*it)->hasInstalledObj())
- if (!(*it)->hasCandidateObj() || !(*it)->candidatePoolItem().isBroken())
+ if ((*it)->installedEmpty())
+ if (!(*it)->hasCandidateObj() || !(*it)->candidateObj().isBroken())
continue;
category = addCategory (type, patch->category());
break;
Modified: trunk/gtk/src/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (original)
+++ trunk/gtk/src/yzyppwrapper.h Mon May 5 19:06:23 2008
@@ -106,6 +106,7 @@
virtual std::string getName (Iter it) = 0;
virtual Package *get (Iter it) = 0; /* may be NULL */
+ virtual bool highlight (Iter it) = 0;
struct Listener {
virtual void entryInserted (Iter iter, Package *package) = 0;
@@ -153,6 +154,8 @@
virtual std::string getName (Pool::Iter it)
{ return get (it)->name(); }
+ virtual bool highlight (Pool::Iter it);
+
struct Impl;
Impl *impl;
};
@@ -170,6 +173,7 @@
virtual std::string getName (Pool::Iter it);
virtual Package *get (Pool::Iter it); /* may be NULL */
+ virtual bool highlight (Pool::Iter it) { return false; }
struct Impl;
Impl *impl;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org