Hello community,
here is the log from the commit of package yast2-gtk for openSUSE:Factory
checked in at Fri Jan 7 13:03:03 CET 2011.
--------
--- yast2-gtk/yast2-gtk.changes 2010-12-23 04:08:29.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-gtk/yast2-gtk.changes 2011-01-06 00:11:23.000000000 +0100
@@ -1,0 +2,10 @@
+Wed Jan 05 23:00:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt
+
+- 2.21.87
+- bug fix: YTree was crashing with new libyui
+- YMultiSelectionBox and YTree: show selection count
+when main widget
+- sw_single: show "re-install" popup menu option
+for single package selections.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-gtk-2.21.86.tar.bz2
New:
----
yast2-gtk-2.21.87.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-gtk.spec ++++++
--- /var/tmp/diff_new_pack.AdqUCx/_old 2011-01-07 13:02:34.000000000 +0100
+++ /var/tmp/diff_new_pack.AdqUCx/_new 2011-01-07 13:02:34.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package yast2-gtk (Version 2.21.86)
+# spec file for package yast2-gtk (Version 2.21.87)
#
-# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,11 +18,11 @@
Name: yast2-gtk
-Version: 2.21.86
+Version: 2.21.87
Release: 1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-gtk-2.21.86.tar.bz2
+Source0: yast2-gtk-2.21.87.tar.bz2
Url: http://en.opensuse.org/YaST2-GTK
Summary: YaST2 - GTK+ Graphical User Interface
Group: System/YaST
++++++ yast2-gtk-2.21.86.tar.bz2 -> yast2-gtk-2.21.87.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/package/yast2-gtk.changes new/yast2-gtk-2.21.87/package/yast2-gtk.changes
--- old/yast2-gtk-2.21.86/package/yast2-gtk.changes 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/package/yast2-gtk.changes 2011-01-06 00:09:29.000000000 +0100
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Wed Jan 05 23:00:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt
+
+- 2.21.87
+- bug fix: YTree was crashing with new libyui
+- YMultiSelectionBox and YTree: show selection count
+when main widget
+- sw_single: show "re-install" popup menu option
+for single package selections.
+
+-------------------------------------------------------------------
Tue Dec 23 03:10:00 WET 2010 - rpmcruz@alunos.dcc.fc.up.pt
- 2.21.86
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/package/yast2-gtk.spec new/yast2-gtk-2.21.87/package/yast2-gtk.spec
--- old/yast2-gtk-2.21.86/package/yast2-gtk.spec 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/package/yast2-gtk.spec 1970-01-01 01:00:00.000000000 +0100
@@ -1,68 +0,0 @@
-#
-# spec file for package yast2-gtk (Version 2.21.85)
-#
-# norootforbuild;,
-
-
-Name: yast2-gtk
-Version: 2.21.85
-Release: 0
-
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-gtk-2.21.85.tar.bz2
-Url: http://en.opensuse.org/YaST2-GTK
-Summary: YaST2 - GTK+ Graphical User Interface
-Group: System/YaST
-License: GPL v2.1 or later
-BuildRequires: cmake
-BuildRequires: gcc-c++ blocxx-devel libxcrypt-devel
-BuildRequires: gtk2-devel
-%if 0%{?suse_version} > 1130
-BuildRequires: gdk-pixbuf-devel
-%endif
-BuildRequires: yast2-devtools >= 2.16.3
-BuildRequires: yast2-libyui-devel >= 2.18.8
-BuildRequires: libzypp-devel >= 6.3.0
-Requires: gtk2
-Requires: yast2-libyui >= 2.18.8
-Requires: yast2_theme >= 2.16.1
-Requires: libzypp >= 6.3.0
-Provides: yast2_ui yast2-ui-gtk
-Provides: yast2_ui_pkg
-Source1: yast2-gtk-rpmlintrc
-
-%description
-One of several user interfaces available for YaST2, based on GTK and
-the X Window System.
-
-%prep
-%setup
-
-%build
-mkdir build
-cd build
-export CFLAGS="$RPM_OPT_FLAGS"
-export CXXFLAGS="$CFLAGS"
-cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
- -DLIB=%{_lib} \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_SKIP_RPATH=1 \
- ..
-make %{?_smp_mflags} VERBOSE=1
-
-%install
-cd build
-make install DESTDIR=$RPM_BUILD_ROOT
-cd ..
-
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
-%files
-%defattr (-, root, root)
-%dir %_libdir/YaST2
-%_libdir/YaST2/plugin/
-
-%changelog
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/src/pkg/ygtkpkgdetailview.cc new/yast2-gtk-2.21.87/src/pkg/ygtkpkgdetailview.cc
--- old/yast2-gtk-2.21.86/src/pkg/ygtkpkgdetailview.cc 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/src/pkg/ygtkpkgdetailview.cc 2011-01-06 00:09:29.000000000 +0100
@@ -21,6 +21,8 @@
#include "ygtkpkglistview.h"
#include
+//#define ATRI_BUTTONS
+
#define BROWSER_BIN "/usr/bin/firefox"
#define GNOME_OPEN_BIN "/usr/bin/gnome-open"
@@ -429,23 +431,70 @@
versions.clear();
}
+#ifdef ATRI_BUTTONS
+static void atri_button_clicked_cb (GtkToggleButton *button, VersionExpander *pThis)
+{
+ BusyOp op;
+ Ypp::Selectable sel = pThis->list.get (0);
+
+ if (!gtk_toggle_button_get_active (button)) { /* was active before pressing? */
+ sel.undo();
+ return;
+ }
+
+ int nb = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "nb"));
+ std::list Ypp::Version::iterator it = pThis->versions.begin();
+ for (int i = 0; i < nb; i++) it++;
+
+ // guard with startTransaction() ...
+
+ if (sel.toModify())
+ sel.undo();
+
+ Ypp::Version &version = *it;
+ if (version.isInstalled())
+ sel.remove();
+ else {
+ sel.setCandidate (version);
+ sel.install();
+ }
+}
+#endif
+
GtkWidget *addVersion (Ypp::Selectable &sel, Ypp::Version version, GtkWidget *group)
{
+ GtkWidget *widget;
+#ifdef ATRI_BUTTONS
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
+ GtkWidget *button = gtk_toggle_button_new();
+ gtk_container_add (GTK_CONTAINER (button), gtk_image_new());
+ GtkWidget *label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+ updateRadio (hbox, sel, version);
+ widget = hbox;
+ g_object_set_data (G_OBJECT (button), "nb", GINT_TO_POINTER (versions.size()));
+ g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (atri_button_clicked_cb), this);
+#else
GtkWidget *radio = gtk_radio_button_new_with_label_from_widget
(GTK_RADIO_BUTTON (group), "");
updateRadio (radio, sel, version);
- gtk_box_pack_start (GTK_BOX (versions_box), radio, FALSE, TRUE, 0);
if (version.toModify())
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
g_signal_connect (G_OBJECT (radio), "toggled",
G_CALLBACK (version_toggled_cb), this);
-
+ widget = radio;
+#endif
if ((versions.size() % 2) == 1)
- g_signal_connect (G_OBJECT (radio), "expose-event",
+ g_signal_connect (G_OBJECT (widget), "expose-event",
G_CALLBACK (draw_gray_cb), NULL);
versions.push_back (version);
- return radio;
+ gtk_box_pack_start (GTK_BOX (versions_box), widget, FALSE, TRUE, 0);
+
+ return widget;
}
void updateRadio (GtkWidget *radio, Ypp::Selectable &sel, Ypp::Version &version)
@@ -471,9 +520,69 @@
modified ? "<i>" : "", number.c_str(), arch.c_str(), repo.c_str(),
modified ? "</i>" : "");
+#ifdef ATRI_BUTTONS
+ GList *children = gtk_container_get_children (GTK_CONTAINER (radio));
+ GtkWidget *_label = (GtkWidget *) children->data;
+ GtkWidget *_button = (GtkWidget *) children->next->data;
+ gtk_label_set_markup (GTK_LABEL (_label), label);
+ if (number.size() > 20)
+ gtk_widget_set_tooltip_markup (_label, tooltip);
+ g_list_free (children);
+
+ const gchar *stock, *l;
+ bool can_never_modify;
+ if (version.isInstalled()) {
+ l = _("Remove");
+ stock = GTK_STOCK_DELETE;
+ can_never_modify = !sel.canRemove();
+ modified = sel.toRemove();
+ }
+ else {
+ if (sel.hasInstalledVersion()) {
+ Ypp::Version installed = sel.installed();
+ if (installed < version) {
+ l = _("Upgrade");
+ stock = GTK_STOCK_GO_UP;
+ }
+ else if (installed > version) {
+ l = _("Downgrade");
+ stock = GTK_STOCK_GO_DOWN;
+ }
+ else {
+ l = _("Re-install");
+ stock = GTK_STOCK_REFRESH;
+ }
+ }
+ else {
+ l = _("Install");
+ stock = GTK_STOCK_SAVE;
+ }
+ modified = sel.toInstall();
+ }
+ if (modified)
+ l = _("Undo");
+ bool can_modify = !sel.isLocked();
+ modified = modified && version.toModify();
+
+g_signal_handlers_block_by_func (_button, (gpointer) atri_button_clicked_cb, this);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_button), modified);
+g_signal_handlers_unblock_by_func (_button, (gpointer) atri_button_clicked_cb, this);
+ gtk_widget_set_sensitive (_button, can_modify);
+/* if (can_never_modify)
+ gtk_widget_hide (_button);
+ else
+ gtk_widget_show (_button);
+*/
+ // stock is never changed -- could be set previously...
+ gtk_widget_set_tooltip_text (_button, l);
+ gtk_image_set_from_stock (GTK_IMAGE (GTK_BIN(_button)->child), stock, GTK_ICON_SIZE_BUTTON);
+
+#else
gtk_label_set_markup (GTK_LABEL (GTK_BIN (radio)->child), label);
if (number.size() > 20)
gtk_widget_set_tooltip_markup (radio, tooltip);
+#endif
+
g_free (tooltip);
g_free (label);
}
@@ -530,6 +639,10 @@
void updateButton()
{
+#ifdef ATRI_BUTTONS
+if (list.size() == 1) { gtk_widget_hide (button); gtk_widget_hide (undo_button); return; }
+#endif
+
const char *label = 0, *stock = 0;
bool modified = false, can_modify = true, can_never_modify = false;
if (list.size() == 1) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/src/pkg/ygtkpkglistview.cc new/yast2-gtk-2.21.87/src/pkg/ygtkpkglistview.cc
--- old/yast2-gtk-2.21.86/src/pkg/ygtkpkglistview.cc 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/src/pkg/ygtkpkglistview.cc 2011-01-06 00:09:29.000000000 +0100
@@ -417,6 +417,8 @@
}
static void install_cb (GtkMenuItem *item, YGtkPkgListView *pThis)
{ pThis->getSelected().install(); }
+ static void reinstall_cb (GtkMenuItem *item, YGtkPkgListView *pThis)
+ { reinstall (pThis->getSelected().get(0)); }
static void remove_cb (GtkMenuItem *item, YGtkPkgListView *pThis)
{ pThis->getSelected().remove(); }
static void undo_cb (GtkMenuItem *item, YGtkPkgListView *pThis)
@@ -427,11 +429,39 @@
{ pThis->getSelected().lock (false); }
static void select_all_cb (GtkMenuItem *item, YGtkPkgListView *pThis)
{ pThis->selectAll(); }
+
+ static bool hasReinstall (Ypp::Selectable sel)
+ {
+ if (sel.hasInstalledVersion()) {
+ Ypp::Version installedVersion = sel.installed();
+ for (int i = 0; i < sel.totalVersions(); i++) {
+ Ypp::Version version = sel.version (i);
+ if (!version.isInstalled() && version == installedVersion)
+ return true;
+ }
+ }
+ return false;
+ }
+ static void reinstall (Ypp::Selectable sel)
+ {
+ Ypp::Version installedVersion = sel.installed();
+ for (int i = 0; i < sel.totalVersions(); i++) {
+ Ypp::Version version = sel.version (i);
+ if (!version.isInstalled() && version == installedVersion) {
+ sel.setCandidate (version);
+ sel.install();
+ break;
+ }
+ }
+ }
};
GtkWidget *menu = gtk_menu_new();
- bool empty = true;
Ypp::List list = pThis->getSelected();
+ Ypp::Selectable::Type type = Ypp::Selectable::PACKAGE;
+ if (list.size() > 0)
+ type = list.get(0).type();
+
if (!outreach) {
Ypp::ListProps props (list);
@@ -440,35 +470,38 @@
bool locked = !unlocked && canLock;
if (props.isNotInstalled() && !modified)
inner::appendItem (menu, _("_Install"), 0, GTK_STOCK_SAVE,
- !locked, inner::install_cb, pThis), empty = false;
+ !locked, inner::install_cb, pThis);
if (props.hasUpgrade() && !modified)
inner::appendItem (menu, _("_Upgrade"), 0, GTK_STOCK_GO_UP,
- !locked, inner::install_cb, pThis), empty = false;
+ !locked, inner::install_cb, pThis);
+ if (type == Ypp::Selectable::PACKAGE && list.size() == 1 && inner::hasReinstall (list.get(0)) && !modified)
+ inner::appendItem (menu, _("_Re-install"), 0, GTK_STOCK_REFRESH,
+ !locked, inner::reinstall_cb, pThis);
if (props.isInstalled() && !modified)
inner::appendItem (menu, _("_Remove"), 0, GTK_STOCK_DELETE,
- !locked && props.canRemove(), inner::remove_cb, pThis), empty = false;
+ !locked && props.canRemove(), inner::remove_cb, pThis);
if (modified)
inner::appendItem (menu, _("_Undo"), 0, GTK_STOCK_UNDO,
- true, inner::undo_cb, pThis), empty = false;
+ true, inner::undo_cb, pThis);
if (canLock) {
static const char *lock_tooltip =
"<b>Package lock:</b> prevents the package status from being modified by "
"the dependencies resolver.";
if (props.isLocked())
inner::appendItem (menu, _("_Unlock"), _(lock_tooltip),
- GTK_STOCK_DIALOG_AUTHENTICATION, true, inner::unlock_cb, pThis), empty = false;
+ GTK_STOCK_DIALOG_AUTHENTICATION, true, inner::unlock_cb, pThis);
if (unlocked)
inner::appendItem (menu, _("_Lock"), _(lock_tooltip),
GTK_STOCK_DIALOG_AUTHENTICATION, !modified,
- inner::lock_cb, pThis), empty = false;
+ inner::lock_cb, pThis);
}
}
- Ypp::Selectable::Type type = Ypp::Selectable::PACKAGE;
- if (list.size())
- type = list.get(0).type();
if (type == Ypp::Selectable::PACKAGE || type == Ypp::Selectable::PATCH) {
- if (!empty)
+ GList *items = gtk_container_get_children (GTK_CONTAINER (menu));
+ g_list_free (items);
+
+ if (items != NULL) /* add separator if there are other items */
gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new());
inner::appendItem (menu, NULL, NULL, GTK_STOCK_SELECT_ALL,
true, inner::select_all_cb, pThis);
@@ -990,7 +1023,7 @@
std::string getRepositoryLabel (Ypp::Repository &repo)
{
std::string name (repo.name()), url, str;
- url = repo.isSystem() ? _("System") : repo.url();
+ url = repo.isSystem() ? _("Installed packages") : repo.url();
str.reserve (name.size() + url.size() + 64);
str = name + "\n";
str += "";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/src/YGDialog.cc new/yast2-gtk-2.21.87/src/YGDialog.cc
--- old/yast2-gtk-2.21.86/src/YGDialog.cc 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/src/YGDialog.cc 2011-01-06 00:09:29.000000000 +0100
@@ -25,9 +25,9 @@
//#define DEFAULT_WIDTH 750
//#define DEFAULT_HEIGHT 650
-#define DEFAULT_CHAR_WIDTH 62
+#define DEFAULT_CHAR_WIDTH 60
#define DEFAULT_CHAR_HEIGHT 28
-#define DEFAULT_PIXEL_WIDTH 350
+#define DEFAULT_PIXEL_WIDTH 330
#define DEFAULT_PIXEL_HEIGHT 200
class YGWindow;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/src/YGTreeView.cc new/yast2-gtk-2.21.87/src/YGTreeView.cc
--- old/yast2-gtk-2.21.86/src/YGTreeView.cc 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/src/YGTreeView.cc 2011-01-06 00:09:29.000000000 +0100
@@ -14,6 +14,7 @@
#include "YSelectionWidget.h"
#include "YGSelectionStore.h"
#include "ygtktreeview.h"
+#include
/* A generic widget for table related widgets. */
@@ -21,13 +22,15 @@
{
protected:
guint m_blockTimeout;
+ int markColumn;
+ GtkWidget *m_count;
public:
YGTreeView (YWidget *ywidget, YWidget *parent, const string &label, bool tree)
: YGScrolledWidget (ywidget, parent, label, YD_VERT, YGTK_TYPE_TREE_VIEW, NULL),
YGSelectionStore (tree)
{
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (getWidget()), FALSE);
+ gtk_tree_view_set_headers_visible (getView(), FALSE);
/* Yast tools expect the user to be unable to un-select the row. They
generally don't check to see if the returned value is -1. So, just
@@ -39,6 +42,7 @@
connect (getWidget(), "right-click", G_CALLBACK (right_click_cb), this);
m_blockTimeout = 0; // GtkTreeSelection idiotically fires when showing widget
+ markColumn = -1; m_count = NULL;
g_signal_connect (getWidget(), "map", G_CALLBACK (block_init_cb), this);
}
@@ -79,6 +83,8 @@
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (getView(), column);
+ if (gtk_tree_view_get_search_column (getView()) == -1)
+ gtk_tree_view_set_search_column (getView(), text_col);
}
void addCheckColumn (int check_col)
@@ -87,16 +93,70 @@
g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (check_col));
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes (
NULL, renderer, "active", check_col, NULL);
+ gtk_tree_view_column_set_cell_data_func (column, renderer, inconsistent_mark_cb, this, NULL);
g_signal_connect (G_OBJECT (renderer), "toggled",
G_CALLBACK (toggled_cb), this);
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_append_column (getView(), column);
+ if (markColumn == -1)
+ markColumn = check_col;
}
void readModel()
{ gtk_tree_view_set_model (getView(), getModel()); }
+ void addCountWidget (YWidget *yparent)
+ {
+ bool mainWidget = true;
+ for (; yparent; yparent->parent()) {
+ YLayoutBox *box = dynamic_cast (yparent);
+ if (box) {
+ mainWidget = box->primary() == YD_VERT;
+ break;
+ }
+ }
+ if (mainWidget) {
+ m_count = gtk_label_new ("0");
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 4);
+ GtkWidget *label = gtk_label_new (_("Total selected:"));
+ //gtk_box_pack_start (GTK_BOX (hbox), gtk_event_box_new(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_count, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (YGWidget::getWidget()), hbox, FALSE, TRUE, 0);
+ gtk_widget_show_all (hbox);
+ }
+ }
+
+ void syncCount()
+ {
+ if (!m_count) return;
+
+ struct inner {
+ static gboolean foreach (
+ GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer _pThis)
+ {
+ YGTreeView *pThis = (YGTreeView *) _pThis;
+ gboolean mark;
+ gtk_tree_model_get (model, iter, pThis->markColumn, &mark, -1);
+ if (mark) {
+ int count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "count"));
+ g_object_set_data (G_OBJECT (model), "count", GINT_TO_POINTER (count+1));
+ }
+ return FALSE;
+ }
+ };
+
+ GtkTreeModel *model = getModel();
+ g_object_set_data (G_OBJECT (model), "count", 0);
+ gtk_tree_model_foreach (model, inner::foreach, this);
+
+ int count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "count"));
+ gchar *str = g_strdup_printf ("%d", count);
+ gtk_label_set_text (GTK_LABEL (m_count), str);
+ g_free (str);
+ }
+
void focusItem (YItem *item, bool select)
{
GtkTreeIter iter;
@@ -130,7 +190,7 @@
GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer _pThis)
{
YGTreeView *pThis = (YGTreeView *) _pThis;
- pThis->setRowMark (iter, pThis->markColumn(), FALSE);
+ pThis->setRowMark (iter, pThis->markColumn, FALSE);
return FALSE;
}
};
@@ -141,8 +201,6 @@
virtual bool _immediateMode() { return true; }
virtual bool _shrinkable() { return false; }
- virtual int markColumn() { return -1; }
-
void toggleMark (GtkTreePath *path, gint column)
{
GtkTreeIter iter;
@@ -154,6 +212,7 @@
state = !state;
setRowMark (&iter, column, state);
getYItem (&iter)->setSelected (state);
+ syncCount();
emitEvent (YEvent::ValueChanged);
}
@@ -185,6 +244,29 @@
// callbacks
+ static bool all_marked (GtkTreeModel *model, GtkTreeIter *iter, int mark_col)
+ {
+ gboolean marked;
+ GtkTreeIter child_iter;
+ if (gtk_tree_model_iter_children (model, &child_iter, iter))
+ do {
+ gtk_tree_model_get (model, &child_iter, mark_col, &marked, -1);
+ if (!marked) return false;
+ all_marked (model, &child_iter, mark_col);
+ } while (gtk_tree_model_iter_next (model, &child_iter));
+ return true;
+ }
+
+ static void inconsistent_mark_cb (GtkTreeViewColumn *column,
+ GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+ { // used for trees -- show inconsistent if one node is check but another isn't
+ YGTreeView *pThis = (YGTreeView *) data;
+ gboolean marked;
+ gtk_tree_model_get (model, iter, pThis->markColumn, &marked, -1);
+ gboolean consistent = !marked || all_marked (model, iter, pThis->markColumn);
+ g_object_set (G_OBJECT (cell), "inconsistent", !consistent, NULL);
+ }
+
static void selection_changed_cb (GtkTreeSelection *selection, YGTreeView *pThis)
{
struct inner {
@@ -200,7 +282,7 @@
};
if (pThis->m_blockTimeout) return;
- if (pThis->markColumn() < 0)
+ if (pThis->markColumn == -1)
gtk_tree_model_foreach (pThis->getModel(), inner::foreach_sync_select, pThis);
if (pThis->_immediateMode())
pThis->emitEvent (YEvent::SelectionChanged, IF_NOT_PENDING_EVENT);
@@ -209,8 +291,8 @@
static void activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
GtkTreeViewColumn *column, YGTreeView* pThis)
{
- if (pThis->markColumn() >= 0)
- pThis->toggleMark (path, pThis->markColumn());
+ if (pThis->markColumn >= 0)
+ pThis->toggleMark (path, pThis->markColumn);
else {
// for tree - expand/collpase double-clicked rows
if (gtk_tree_view_row_expanded (tree_view, path))
@@ -229,6 +311,10 @@
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), "column"));
pThis->toggleMark (path, column);
gtk_tree_path_free (path);
+
+ // un/marking a sub-node can cause changes of "inconsistency"
+ if (gtk_tree_path_get_depth (path) >= 2)
+ gtk_widget_queue_draw (pThis->getWidget());
}
static void right_click_cb (YGtkTreeView *view, gboolean outreach, YGTreeView *pThis)
@@ -500,12 +586,12 @@
addTextColumn (1, 2);
createStore (3, types);
readModel();
+ addCountWidget (parent);
}
// YGTreeView
virtual bool _shrinkable() { return shrinkable(); }
- virtual int markColumn() { return 0; }
// YGSelectionStore
@@ -515,6 +601,7 @@
addRow (item, &iter);
setRowMark (&iter, 0, item->selected());
setRowText (&iter, 1, item->iconName(), 2, item->label(), this);
+ syncCount();
}
void doSelectItem (YItem *item, bool select)
@@ -522,10 +609,11 @@
GtkTreeIter iter;
getTreeIter (item, &iter);
setRowMark (&iter, 0, select);
+ syncCount();
}
void doDeselectAllItems()
- { unmarkAll(); }
+ { unmarkAll(); syncCount(); }
// YMultiSelectionBox
@@ -568,15 +656,15 @@
addCheckColumn (2);
addTextColumn (0, 1);
createStore (3, types);
+ addCountWidget (parent);
}
else
-#else
+#endif
{
GType types [2] = { GDK_TYPE_PIXBUF, G_TYPE_STRING };
addTextColumn (0, 1);
createStore (2, types);
}
-#endif
readModel();
g_signal_connect (getWidget(), "row-collapsed", G_CALLBACK (row_collapsed_cb), this);
@@ -647,14 +735,9 @@
};
gtk_tree_model_foreach (getModel(), inner::foreach_sync_open, this);
+ syncCount();
}
- // YGTreeView
-
-#if YAST2_VERSION >= 2019002
- virtual int markColumn() { return hasMultiSelection() ? 2 : -1; }
-#endif
-
// YGSelectionStore
void doAddItem (YItem *item) {} // rebuild will be called anyway
@@ -666,6 +749,7 @@
GtkTreeIter iter;
getTreeIter (item, &iter);
setRowMark (&iter, 2, select);
+ syncCount();
}
else
#endif
@@ -675,8 +759,10 @@
void doDeselectAllItems()
{
#if YAST2_VERSION >= 2019002
- if (hasMultiSelection())
+ if (hasMultiSelection()) {
unmarkAll();
+ syncCount();
+ }
else
#endif
unfocusAllItems();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/VERSION new/yast2-gtk-2.21.87/VERSION
--- old/yast2-gtk-2.21.86/VERSION 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/VERSION 2011-01-06 00:09:29.000000000 +0100
@@ -1 +1 @@
-2.21.86
+2.21.87
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-gtk-2.21.86/VERSION.cmake new/yast2-gtk-2.21.87/VERSION.cmake
--- old/yast2-gtk-2.21.86/VERSION.cmake 2010-12-23 04:07:52.000000000 +0100
+++ new/yast2-gtk-2.21.87/VERSION.cmake 2011-01-06 00:09:29.000000000 +0100
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "2")
SET(VERSION_MINOR "21")
-SET(VERSION_PATCH "86")
+SET(VERSION_PATCH "87")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org