* hildon/hildon-pannable-area.c,
(hildon_pannable_area_remove_timeouts): Adding this new function
with code that removes the timeouts of the widget.
(hildon_pannable_area_dispose),
(hildon_pannable_area_unrealize): Use the new remove function to
stop timeouts when unrealizing and disposing.
(hildon_pannable_area_scroll_to): Added a CLAMP to the position
calculation to avoid negative values in some cases.
Fixes: NB#135179 (Remove pannable timeouts in unrealize function)
+2009-08-26 Alejandro G. Castro <alex@igalia.com>
+
+ * hildon/hildon-pannable-area.c,
+ (hildon_pannable_area_remove_timeouts): Adding this new function
+ with the code that removes the timeouts of the widget.
+ (hildon_pannable_area_dispose),
+ (hildon_pannable_area_unrealize): Use the new remove function to
+ stop timeouts when unrealizing and disposing.
+ (hildon_pannable_area_scroll_to): Added a CLAMP to the position
+ calculation to avoid negative values in some cases.
+
+ Fixes: NB#135179 (Remove pannable timeouts in unrealize function)
+
2009-08-24 Claudio Saavedra <csaavedra@igalia.com>
* examples/hildon-check-button-example.c: (button_toggled_cb):
2009-08-24 Claudio Saavedra <csaavedra@igalia.com>
* examples/hildon-check-button-example.c: (button_toggled_cb):
guint property_id,
const GValue * value,
GParamSpec * pspec);
guint property_id,
const GValue * value,
GParamSpec * pspec);
+static void hildon_pannable_area_remove_timeouts (GtkWidget * widget);
static void hildon_pannable_area_dispose (GObject * object);
static void hildon_pannable_area_realize (GtkWidget * widget);
static void hildon_pannable_area_unrealize (GtkWidget * widget);
static void hildon_pannable_area_dispose (GObject * object);
static void hildon_pannable_area_realize (GtkWidget * widget);
static void hildon_pannable_area_unrealize (GtkWidget * widget);
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (object)->priv;
GtkWidget *child = gtk_bin_get_child (GTK_BIN (object));
HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (object)->priv;
GtkWidget *child = gtk_bin_get_child (GTK_BIN (object));
- if (priv->idle_id) {
- g_signal_emit (object, pannable_area_signals[PANNING_FINISHED], 0);
- g_source_remove (priv->idle_id);
- priv->idle_id = 0;
- }
-
- if (priv->scroll_indicator_timeout){
- g_source_remove (priv->scroll_indicator_timeout);
- priv->scroll_indicator_timeout = 0;
- }
-
- if (priv->motion_event_scroll_timeout){
- g_source_remove (priv->motion_event_scroll_timeout);
- priv->motion_event_scroll_timeout = 0;
- }
+ hildon_pannable_area_remove_timeouts (GTK_WIDGET (object));
if (child) {
g_signal_handlers_disconnect_by_func (child,
if (child) {
g_signal_handlers_disconnect_by_func (child,
gdk_gc_copy (priv->scrollbars_gc, widget->style->fg_gc[GTK_STATE_INSENSITIVE]);
}
gdk_gc_copy (priv->scrollbars_gc, widget->style->fg_gc[GTK_STATE_INSENSITIVE]);
}
+
+static void
+hildon_pannable_area_remove_timeouts (GtkWidget * widget)
+{
+ HildonPannableAreaPrivate *priv = HILDON_PANNABLE_AREA (widget)->priv;
+
+ if (priv->idle_id) {
+ g_signal_emit (widget, pannable_area_signals[PANNING_FINISHED], 0);
+ g_source_remove (priv->idle_id);
+ priv->idle_id = 0;
+ }
+
+ if (priv->scroll_indicator_timeout){
+ g_source_remove (priv->scroll_indicator_timeout);
+ priv->scroll_indicator_timeout = 0;
+ }
+
+ if (priv->motion_event_scroll_timeout){
+ g_source_remove (priv->motion_event_scroll_timeout);
+ priv->motion_event_scroll_timeout = 0;
+ }
+}
+
static void
hildon_pannable_area_unrealize (GtkWidget * widget)
{
static void
hildon_pannable_area_unrealize (GtkWidget * widget)
{
priv = HILDON_PANNABLE_AREA (widget)->priv;
priv = HILDON_PANNABLE_AREA (widget)->priv;
+ hildon_pannable_area_remove_timeouts (widget);
+
if (priv->event_window != NULL) {
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
if (priv->event_window != NULL) {
gdk_window_set_user_data (priv->event_window, NULL);
gdk_window_destroy (priv->event_window);
g_return_if_fail (x < width || y < height);
if ((x > -1)&&(hscroll_visible)) {
g_return_if_fail (x < width || y < height);
if ((x > -1)&&(hscroll_visible)) {
- priv->scroll_to_x = x - priv->hadjust->page_size/2;
+ priv->scroll_to_x = CLAMP (x - priv->hadjust->page_size/2,
+ priv->hadjust->lower,
+ priv->hadjust->upper - priv->hadjust->page_size);
dist_x = priv->scroll_to_x - priv->hadjust->value;
if (dist_x == 0) {
priv->scroll_to_x = -1;
dist_x = priv->scroll_to_x - priv->hadjust->value;
if (dist_x == 0) {
priv->scroll_to_x = -1;
}
if ((y > -1)&&(vscroll_visible)) {
}
if ((y > -1)&&(vscroll_visible)) {
- priv->scroll_to_y = y - priv->vadjust->page_size/2;
+ priv->scroll_to_y = CLAMP (y - priv->vadjust->page_size/2,
+ priv->vadjust->lower,
+ priv->vadjust->upper - priv->vadjust->page_size);
dist_y = priv->scroll_to_y - priv->vadjust->value;
if (dist_y == 0) {
priv->scroll_to_y = -1;
dist_y = priv->scroll_to_y - priv->vadjust->value;
if (dist_y == 0) {
priv->scroll_to_y = -1;
- if ((priv->scroll_to_y == -1) && (priv->scroll_to_y == -1)) {
+ if ((priv->scroll_to_y == -1) && (priv->scroll_to_x == -1)) {