[gnome-initial-setup] gis-assistant: Skip invisible pages
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] gis-assistant: Skip invisible pages
- Date: Wed, 14 Nov 2012 18:15:06 +0000 (UTC)
commit 614d2908393f4be1b02c4fae4dd0570d35bca238
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Nov 14 12:10:38 2012 -0500
gis-assistant: Skip invisible pages
This allows us to skip the network page if we're already connected.
gnome-initial-setup/gis-assistant.c | 38 ++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index 858d6c6..7c08957 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -96,29 +96,45 @@ gis_assistant_next_page (GisAssistant *assistant)
priv->current_page);
}
+static inline gboolean
+should_show_page (GList *l)
+{
+ return l != NULL && gtk_widget_get_visible (GTK_WIDGET (l->data));
+}
+
+static GisPage *
+find_next_page (GisPage *page)
+{
+ GList *l = page->assistant_priv->link->next;
+ while (!should_show_page (l)) {
+ l = l->next;
+ }
+ return GIS_PAGE (l->data);
+}
+
static void
gis_assistant_real_next_page (GisAssistant *assistant,
GisPage *page)
{
- GisAssistantPrivate *priv = assistant->priv;
- GisPage *next_page;
-
- g_return_if_fail (priv->current_page != NULL);
+ gis_assistant_switch_to (assistant, find_next_page (page));
+}
- next_page = GIS_PAGE (priv->current_page->assistant_priv->link->next->data);
- gis_assistant_switch_to (assistant, next_page);
+static GisPage *
+find_prev_page (GisPage *page)
+{
+ GList *l = page->assistant_priv->link->prev;
+ while (!should_show_page (l)) {
+ l = l->prev;
+ }
+ return GIS_PAGE (l->data);
}
void
gis_assistant_previous_page (GisAssistant *assistant)
{
GisAssistantPrivate *priv = assistant->priv;
- GisPage *prev_page;
-
g_return_if_fail (priv->current_page != NULL);
-
- prev_page = GIS_PAGE (priv->current_page->assistant_priv->link->prev->data);
- gis_assistant_switch_to (assistant, prev_page);
+ gis_assistant_switch_to (assistant, find_prev_page (priv->current_page));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]