[gnome-initial-setup] eulas: Add a scroll requirement
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] eulas: Add a scroll requirement
- Date: Thu, 12 Jul 2012 17:52:09 +0000 (UTC)
commit 8eb92561d584da6a5562eb47fe7453207d7d6a0c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jul 12 13:48:26 2012 -0400
eulas: Add a scroll requirement
That is, the scrolled window must be all the way at the bottom for
things to work properly.
gnome-initial-setup/gis-eula-pages.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/gis-eula-pages.c b/gnome-initial-setup/gis-eula-pages.c
index 4ae4d76..20a4b2d 100644
--- a/gnome-initial-setup/gis-eula-pages.c
+++ b/gnome-initial-setup/gis-eula-pages.c
@@ -22,6 +22,7 @@ struct _EulaPage {
GtkWidget *scrolled_window;
gboolean require_checkbox;
+ gboolean require_scroll;
};
/* heavily lifted from g_output_stream_splice */
@@ -155,6 +156,18 @@ get_page_complete (EulaPage *page)
return FALSE;
}
+ if (page->require_scroll) {
+ GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (page->scrolled_window);
+ GtkAdjustment *vadjust = gtk_scrolled_window_get_vadjustment (scrolled_window);
+ gdouble value, upper;
+
+ value = gtk_adjustment_get_value (vadjust);
+ upper = gtk_adjustment_get_upper (vadjust) - gtk_adjustment_get_page_size (vadjust);
+
+ if (value < upper)
+ return FALSE;
+ }
+
return TRUE;
}
@@ -167,7 +180,8 @@ sync_page_complete (EulaPage *page)
static void
get_config (GFile *eula,
- gboolean *require_checkbox)
+ gboolean *require_checkbox,
+ gboolean *require_scroll)
{
gchar *path, *config_path;
GError *error = NULL;
@@ -183,6 +197,9 @@ get_config (GFile *eula,
*require_checkbox = g_key_file_get_boolean (config, "Requirements",
"require-checkbox", NULL);
+ *require_scroll = g_key_file_get_boolean (config, "Requirements",
+ "require-scroll", NULL);
+
out:
g_clear_error (&error);
g_key_file_unref (config);
@@ -198,6 +215,7 @@ build_eula_page (SetupData *setup,
EulaPage *page;
gboolean require_checkbox = TRUE;
+ gboolean require_scroll = FALSE;
text_view = build_eula_text_view (eula);
if (text_view == NULL)
@@ -219,9 +237,10 @@ build_eula_page (SetupData *setup,
page->text_view = text_view;
page->scrolled_window = scrolled_window;
- get_config (eula, &require_checkbox);
+ get_config (eula, &require_checkbox, &require_scroll);
page->require_checkbox = require_checkbox;
+ page->require_scroll = require_scroll;
if (require_checkbox) {
GtkWidget *checkbox;
@@ -240,6 +259,17 @@ build_eula_page (SetupData *setup,
page->checkbox = checkbox;
}
+ if (require_scroll) {
+ GtkAdjustment *vadjust;
+ vadjust = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window));
+ g_signal_connect_swapped (vadjust, "changed",
+ G_CALLBACK (sync_page_complete),
+ page);
+ g_signal_connect_swapped (vadjust, "value-changed",
+ G_CALLBACK (sync_page_complete),
+ page);
+ }
+
g_object_set_data (G_OBJECT (vbox), "gis-page-title", _("License Agreements"));
gis_assistant_add_page (gis_get_assistant (setup), vbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]