Author: rpmcruz
Date: Wed Sep 30 18:26:05 2009
New Revision: 58849
URL: http://svn.opensuse.org/viewcvs/yast?rev=58849&view=rev
Log:
* src/ygtkzyppview.h/cc: map package text-view details
scrolling to the view-port they are installed on.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/ygtkzyppview.cc
trunk/gtk/src/ygtkzyppview.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=58849&r1=58848&r2=58849&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Wed Sep 30 18:26:05 2009
@@ -1,3 +1,8 @@
+2009-09-30 Ricardo Cruz
+
+ * src/ygtkzyppview.h/cc: map package text-view details
+ scrolling to the view-port they are installed on.
+
2009-09-24 Ricardo Cruz
* src/yzyppwrapper.cc: made compilable for 11.1 libzypp
Modified: trunk/gtk/src/ygtkzyppview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.cc?rev=58849&r1=58848&r2=58849&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.cc (original)
+++ trunk/gtk/src/ygtkzyppview.cc Wed Sep 30 18:26:05 2009
@@ -10,7 +10,6 @@
*/
#define YUILogComponent "gtk"
#include
-#include
#include "ygtkzyppview.h"
#include "ygtktreeview.h"
#include "ygtktreemodel.h"
@@ -22,6 +21,8 @@
#include
#include
#include <list>
+#include
+#include
//** Utilities
@@ -1610,6 +1611,8 @@
gtk_widget_show_all (hbox);
g_signal_connect (G_OBJECT (scroll), "hierarchy-changed",
G_CALLBACK (hierarchy_changed_cb), this);
+ g_signal_connect (G_OBJECT (scroll), "realize",
+ G_CALLBACK (realize_cb), this);
}
~Impl()
@@ -1806,6 +1809,53 @@
pThis->setVerticalMode (vertical);
}
}
+
+ static void move_cursor_cb (GtkTextView *view, GtkMovementStep step, gint count,
+ gboolean extend_selection, Impl *pThis)
+ {
+ GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW (pThis->m_scroll);
+ GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment (scroll);
+ int height = pThis->m_scroll->allocation.height;
+ gdouble increment;
+ switch (step) {
+ case GTK_MOVEMENT_DISPLAY_LINES:
+ increment = height / 10.0;
+ break;
+ case GTK_MOVEMENT_PAGES:
+ increment = height * 0.9;
+ break;
+ case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
+ increment = adj->upper - adj->lower;
+ break;
+ default:
+ increment = 0.0;
+ break;
+ }
+
+ gdouble value = adj->value + (count * increment);
+ value = MIN (value, adj->upper - adj->page_size);
+ value = MAX (value, adj->lower);
+ if (value != adj->value)
+ gtk_adjustment_set_value (adj, value);
+ }
+
+ static inline void fix_keybindings (Impl *pThis, GtkWidget *widget)
+ {
+ if (widget)
+ g_signal_connect (G_OBJECT (widget), "move-cursor",
+ G_CALLBACK (move_cursor_cb), pThis);
+ }
+
+ static void realize_cb (GtkWidget *widget, Impl *pThis)
+ {
+ fix_keybindings (pThis, pThis->m_description);
+ fix_keybindings (pThis, pThis->m_filelist);
+ fix_keybindings (pThis, pThis->m_changelog);
+ fix_keybindings (pThis, pThis->m_authors);
+ fix_keybindings (pThis, pThis->m_support);
+ fix_keybindings (pThis, pThis->m_requires);
+ fix_keybindings (pThis, pThis->m_provides);
+ }
};
G_DEFINE_TYPE (YGtkDetailView, ygtk_detail_view, GTK_TYPE_SCROLLED_WINDOW)
Modified: trunk/gtk/src/ygtkzyppview.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.h?rev=58849&r1=58848&r2=58849&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.h (original)
+++ trunk/gtk/src/ygtkzyppview.h Wed Sep 30 18:26:05 2009
@@ -10,6 +10,7 @@
#include "yzyppwrapper.h"
#include
+#include
namespace ZyppModel {
enum Columns {
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org