Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r55053 - in /trunk/gtk: ChangeLog src/YGComboBox.cc src/YGPackageSelector.cc src/YGSelectionModel.h src/YGTable.cc
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Mon, 26 Jan 2009 17:22:07 -0000
  • Message-id: <E1LRV9z-0003ez-8v@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Mon Jan 26 18:22:06 2009
New Revision: 55053

URL: http://svn.opensuse.org/viewcvs/yast?rev=55053&view=rev
Log:
* src/YGSelectionModel.h: decoupled doSelectItem(NULL) into
doUnselectAllItem().

* src/YGTable.cc: bug fix 468974: selection was broken. Also
fixed YTree's double click crash, and YMultiSelectionBox
check boxes default values.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGSelectionModel.h
trunk/gtk/src/YGTable.cc

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=55053&r1=55052&r2=55053&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Jan 26 18:22:06 2009
@@ -1,3 +1,12 @@
+2009-01-26 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * src/YGSelectionModel.h: decoupled doSelectItem(NULL) into
+ doUnselectAllItem().
+
+ * src/YGTable.cc: bug fix 468974: selection was broken. Also
+ fixed YTree's double click crash, and YMultiSelectionBox
+ check boxes default values.
+
2009-01-21 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/YGProgressBar.cc (YGDownloadProgress): bug fix 460106:

Modified: trunk/gtk/src/YGComboBox.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=55053&r1=55052&r2=55053&view=diff
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Mon Jan 26 18:22:06 2009
@@ -82,11 +82,10 @@

virtual void setText (const string &value)
{
- IMPL
BlockEvents block (this);
- GtkTreeIter iter;
- if (findByText (value, &iter))
- doSelectItem (&iter);
+ GtkTreeIter iter;
+ if (findByText (value, &iter))
+ doSelectItem (&iter);
else
gtk_entry_set_text (getEntry(), value.c_str());
}
@@ -95,12 +94,16 @@
virtual void doSelectItem (GtkTreeIter *iter)
{
BlockEvents block (this);
- if (iter)
- gtk_combo_box_set_active_iter (getComboBox(), iter);
- else
- gtk_combo_box_set_active (getComboBox(), -1);
+ gtk_combo_box_set_active_iter (getComboBox(), iter);
}

+ virtual void doUnselectAll()
+ {
+ BlockEvents block (this);
+ gtk_combo_box_set_active (getComboBox(), -1);
+ }
+
+
virtual YItem *doSelectedItem()
{
GtkTreeIter iter;

Modified: trunk/gtk/src/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=55053&r1=55052&r2=55053&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Mon Jan 26 18:22:06 2009
@@ -2778,6 +2778,10 @@

virtual void doQuery (Ypp::QueryPool::Query *query)
{
+#if (PKG_SELECTOR_FACE == 1)
+query = new Ypp::QueryPool::Query();
+query->addType (Ypp::Package::PACKAGE_TYPE);
+#endif
m_packages->setQuery (query);
}


Modified: trunk/gtk/src/YGSelectionModel.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.h?rev=55053&r1=55052&r2=55053&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.h (original)
+++ trunk/gtk/src/YGSelectionModel.h Mon Jan 26 18:22:06 2009
@@ -29,7 +29,8 @@
virtual void doAddItem (YItem *item);
virtual void doDeleteAllItems();
virtual YItem *doSelectedItem() = 0;
- virtual void doSelectItem (GtkTreeIter *iter) = 0; // NULL to unselect
all
+ virtual void doSelectItem (GtkTreeIter *iter) = 0;
+ virtual void doUnselectAll() = 0;

YItemConstIterator itemsBegin() { return ywidget->itemsBegin(); }
YItemConstIterator itemsEnd() { return ywidget->itemsEnd(); }
@@ -79,7 +80,7 @@
} \
virtual void deselectAllItems() { \
ParentClass::deselectAllItems(); \
- doSelectItem (NULL); \
+ doUnselectAll(); \
} \
virtual YItem *selectedItem() { \
return doSelectedItem(); \

Modified: trunk/gtk/src/YGTable.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=55053&r1=55052&r2=55053&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Mon Jan 26 18:22:06 2009
@@ -10,13 +10,14 @@
#include "YGSelectionModel.h"
#include "ygtkcellrenderertextpixbuf.h"
#include "ygtkscrolledwindow.h"
+#include <time.h>

/* A generic widget for table related widgets. */
class YGTableView : public YGScrolledWidget, public YGSelectionModel
{
protected:
int m_colsNb;
- bool m_blockSelected; // GtkTreeSelection signals act weird
+ time_t m_blockTime; // GtkTreeSelection signals act weird

public:
YGTableView (YWidget *ywidget, YWidget *parent, const string &label,
@@ -26,7 +27,7 @@
, YGSelectionModel ((YSelectionWidget *) ywidget, ordinaryModel, isTree)
{
IMPL
- m_blockSelected = false;
+ m_blockTime = time (NULL);
if (ordinaryModel) {
appendIconTextColumn ("", YAlignUnchanged,
YGSelectionModel::ICON_COLUMN,
YGSelectionModel::LABEL_COLUMN);
@@ -82,7 +83,6 @@

void appendCheckColumn (string header, int bool_col)
{
- IMPL
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;

@@ -100,7 +100,6 @@

void appendDumbColumn()
{
- IMPL
gtk_tree_view_append_column (getView(),
gtk_tree_view_column_new());
}

@@ -110,20 +109,28 @@
virtual bool immediateEvent() { return true; }

// YGSelectionModel
+
virtual void doSelectItem (GtkTreeIter *iter)
{
- m_blockSelected = true;
- if (iter) {
+ if (!gtk_tree_selection_iter_is_selected (getSelection(),
iter)) {
+ m_blockTime = time (NULL);
GtkTreePath *path = gtk_tree_model_get_path
(getModel(), iter);
gtk_tree_view_expand_to_path (getView(), path);

- gtk_tree_selection_select_iter (getSelection(), iter);
if (gtk_tree_selection_get_mode (getSelection()) !=
GTK_SELECTION_MULTIPLE)
gtk_tree_view_scroll_to_cell (getView(), path,
NULL, TRUE, 0.5, 0);
gtk_tree_path_free (path);
+
+ gtk_tree_selection_select_iter (getSelection(), iter);
}
- else
+ }
+
+ virtual void doUnselectAll()
+ {
+ if (gtk_tree_selection_count_selected_rows (getSelection())) {
+ m_blockTime = time (NULL);
gtk_tree_selection_unselect_all (getSelection());
+ }
}

virtual YItem *doSelectedItem()
@@ -168,10 +175,8 @@

static void selection_changed_cb (GtkTreeSelection *selection,
YGTableView *pThis)
{
- if (pThis->m_blockSelected) {
- pThis->m_blockSelected = false;
+ if (time (NULL) - pThis->m_blockTime <= 2)
return;
- }
if (!pThis->toggleMode()) {
GtkTreeSelection *selection = pThis->getSelection();
for (YItemConstIterator it = pThis->itemsBegin(); it !=
pThis->itemsEnd(); it++) {
@@ -450,8 +455,8 @@
}

// YMultiSelectionBox
- virtual void doAddItem (YItem *item)
- {
+ virtual void doAddItem (YItem *item)
+ {
GtkTreeIter iter;
addRow (&iter, item, false);
setCellToggle (&iter, 0, item->selected());
@@ -459,20 +464,6 @@
setCellLabel (&iter, 2, item->label());
}

- virtual void doSelectItem (YItem *item)
- {
- GtkTreeIter iter;
- if (getIter (item, &iter))
- setCellToggle (&iter, 0, item->selected());
- else { // unselect all
- if (gtk_tree_model_get_iter_first (getModel(), &iter)) {
- do {
- setCellToggle (&iter, 0, false);
- } while (gtk_tree_model_iter_next (getModel(),
&iter));
- }
- }
- }
-
virtual YItem *currentItem()
{ return doSelectedItem(); }

@@ -490,13 +481,28 @@
// Events
static void multi_activated_cb (GtkTreeView *tree_view, GtkTreePath
*path,
GtkTreeViewColumn *column,
YGMultiSelectionBox* pThis)
+ { pThis->toggle (path, 0); }
+
+ // YGSelectionModel
+
+ virtual void doSelectItem (GtkTreeIter *iter)
{
- IMPL
- pThis->toggle (path, 0);
+ setCellToggle (iter, 0, true);
}

- virtual bool isShrinkable() { return shrinkable(); }
+ virtual void doUnselectAll()
+ {
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first (getModel(), &iter)) {
+ do {
+ setCellToggle (&iter, 0, false);
+ } while (gtk_tree_model_iter_next (getModel(), &iter));
+ }
+ }

+ // YGWidget
+
+ virtual bool isShrinkable() { return shrinkable(); }
YGWIDGET_IMPL_COMMON (YMultiSelectionBox)
YGSELECTION_WIDGET_IMPL (YMultiSelectionBox)
};
@@ -518,10 +524,10 @@
: YTree (NULL, label)
, YGTableView (this, parent, label, true, true)
{
- connect (getWidget(), "row-activated", G_CALLBACK
(activated_cb), this);
- connect (getWidget(), "cursor-changed", G_CALLBACK
(row_selected_cb), this);
connect (getWidget(), "row-collapsed", G_CALLBACK
(row_collapsed_cb), this);
connect (getWidget(), "row-expanded", G_CALLBACK
(row_expanded_cb), this);
+ connect (getWidget(), "cursor-changed", G_CALLBACK
(row_selected_cb), this);
+ connect (getWidget(), "row-activated", G_CALLBACK
(activated_cb), (YGTableView *) this);
}

// YTree
@@ -583,6 +589,7 @@
}
}
}
+
static void row_selected_cb (GtkTreeView *view, YGTree *pThis)
{
// expand selected row

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages