Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] r58557 - in /trunk/gtk: ChangeLog src/YGTable.cc src/YGText.cc src/YGUtils.cc src/ygtkzyppview.cc
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Mon, 07 Sep 2009 01:12:30 -0000
  • Message-id: <E1MkSmU-0004Tp-Sg@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Mon Sep 7 03:12:24 2009
New Revision: 58557

URL: http://svn.opensuse.org/viewcvs/yast?rev=58557&view=rev
Log:
* src/YGTable.cc: bug fix 513085: block selection was too
ambitious.

* src/YGUtils.cc: fixed flicker from scrolling text
widgets like LogView.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGTable.cc
trunk/gtk/src/YGText.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/ygtkzyppview.cc

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=58557&r1=58556&r2=58557&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Sep 7 03:12:24 2009
@@ -1,7 +1,10 @@
2009-09-06 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

- * src/ygtkrichtext.c: bug fix 523694: when the user right-clicks
- on a link, select the all link so he can easily copy it.
+ * src/YGTable.cc: bug fix 513085: block selection was too
+ ambitious.
+
+ * src/YGUtils.cc: fixed flicker from scrolling text
+ widgets like LogView.

2009-09-06 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>


Modified: trunk/gtk/src/YGTable.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=58557&r1=58556&r2=58557&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Mon Sep 7 03:12:24 2009
@@ -18,7 +18,7 @@
{
protected:
int m_colsNb;
- time_t m_blockTime; // GtkTreeSelection signals act weird
+ bool m_blockSelected;

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

virtual bool immediateEvent() { return true; }

- // YGSelectionModel
+ static gboolean block_selected_timeout_cb (gpointer data)
+ {
+ YGTableView *pThis = (YGTableView *) data;
+ pThis->m_blockSelected = false;
+ return FALSE;
+ }

+ void blockSelected()
+ { // GtkTreeSelection only fires when idle; so set a timeout
+ m_blockSelected = true;
+ g_timeout_add_full (G_PRIORITY_LOW, 250,
block_selected_timeout_cb, this, NULL);
+ }
+
+ // YGSelectionModel
virtual void doSelectItem (GtkTreeIter *iter)
{
if (!gtk_tree_selection_iter_is_selected (getSelection(),
iter)) {
- m_blockTime = time (NULL);
+ blockSelected();
GtkTreePath *path = gtk_tree_model_get_path
(getModel(), iter);
gtk_tree_view_expand_to_path (getView(), path);

@@ -129,7 +141,7 @@
virtual void doUnselectAll()
{
if (gtk_tree_selection_count_selected_rows (getSelection())) {
- m_blockTime = time (NULL);
+ blockSelected();
gtk_tree_selection_unselect_all (getSelection());
}
}
@@ -175,7 +187,7 @@

static void selection_changed_cb (GtkTreeSelection *selection,
YGTableView *pThis)
{
- if (time (NULL) - pThis->m_blockTime <= 2)
+ if (pThis->m_blockSelected)
return;
if (!pThis->toggleMode()) {
GtkTreeSelection *selection = pThis->getSelection();

Modified: trunk/gtk/src/YGText.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGText.cc?rev=58557&r1=58556&r2=58557&view=diff
==============================================================================
--- trunk/gtk/src/YGText.cc (original)
+++ trunk/gtk/src/YGText.cc Mon Sep 7 03:12:24 2009
@@ -59,14 +59,14 @@
gtk_text_buffer_set_text (getBuffer(), text.c_str(), -1);
}

- string getText()
+ std::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);
+ std::string str (text);
g_free (text);
return str;
}
@@ -140,15 +140,10 @@
{}

// YLogView
-
virtual void displayLogText (const string &text)
- {
- setText (text);
- scrollToBottom();
- }
+ { setText (text); }

// YGWidget
-
virtual unsigned int getMinSize (YUIDimension dim)
{
if (dim == YD_VERT) {

Modified: trunk/gtk/src/YGUtils.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=58557&r1=58556&r2=58557&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Mon Sep 7 03:12:24 2009
@@ -397,15 +397,16 @@
gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size);
return FALSE;
}
+
void YGUtils::scrollWidget (GtkAdjustment *vadj, bool top)
{
// for some widgets, we need to change adjustment before moving down...
- gtk_adjustment_set_value (vadj, vadj->lower);
- if (!top) {
+ if (top)
+ gtk_adjustment_set_value (vadj, vadj->lower);
+ else
// since we usually want to call this together with a text
change, we
// must wait till that gets in effect
- g_timeout_add_full (G_PRIORITY_LOW, 25, scroll_down_cb, vadj,
NULL);
- }
+ g_idle_add_full (G_PRIORITY_LOW, scroll_down_cb, vadj, NULL);
}

void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top)

Modified: trunk/gtk/src/ygtkzyppview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.cc?rev=58557&r1=58556&r2=58557&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.cc (original)
+++ trunk/gtk/src/ygtkzyppview.cc Mon Sep 7 03:12:24 2009
@@ -1510,7 +1510,8 @@
void scrollTop()
{
GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW (m_scroll);
- YGUtils::scrollWidget (gtk_scrolled_window_get_vadjustment
(scroll), true);
+ GtkAdjustment *vadj = gtk_scrolled_window_get_vadjustment
(scroll);
+ YGUtils::scrollWidget (vadj, true);
}

// utilities:

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

< Previous Next >
This Thread
  • No further messages