[Xfce4-commits] <xfce4-weather-plugin:master> Scrollbox: Fix not starting with the first label on change.
Harald Judt
noreply at xfce.org
Thu Dec 20 10:56:02 CET 2012
Updating branch refs/heads/master
to 5fcca543a15d77a13e4fdeff88064eedbac1f5b7 (commit)
from e52c04b5c229fc61618a422190e1a9d69124e56f (commit)
commit 5fcca543a15d77a13e4fdeff88064eedbac1f5b7
Author: Harald Judt <h.judt at gmx.at>
Date: Thu Dec 20 10:53:51 2012 +0100
Scrollbox: Fix not starting with the first label on change.
panel-plugin/weather-scrollbox.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index fe2c7f4..3e85dcf 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -256,10 +256,14 @@ gtk_scrollbox_swap_labels(GtkScrollbox *self)
}
/* Keep current list position if possible */
- pos = g_list_position(self->labels, self->active);
+ if (self->active && self->labels_len > 1)
+ pos = g_list_position(self->labels, self->active);
+ else
+ pos = -1;
+
self->labels_len = g_list_length(self->labels_new);
- if (pos >= self->labels_len)
- pos = 0;
+ if (pos >= (gint) self->labels_len)
+ pos = -1;
self->active = g_list_nth(self->labels_new, pos + 1);
if (self->active == NULL)
self->active = self->labels_new;
More information about the Xfce4-commits
mailing list