[gnome-initial-setup/shell/4765: 59/362] eula-page: implement checkboxes and policy dialog
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 59/362] eula-page: implement checkboxes and policy dialog
- Date: Thu, 19 Mar 2015 01:26:01 +0000 (UTC)
commit 39fd1623bfc38cae3256f55a1160db000a73108e
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Fri Jun 13 13:13:17 2014 -0700
eula-page: implement checkboxes and policy dialog
[endlessm/eos-shell#2728]
.../pages/endless-eula/gis-endless-eula-page.c | 102 +++++++++++++++++
.../pages/endless-eula/gis-endless-eula-page.ui | 120 ++++++++++++++++++++
2 files changed, 222 insertions(+), 0 deletions(-)
---
diff --git a/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.c
b/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.c
index 438d880..329f641 100644
--- a/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.c
+++ b/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.c
@@ -38,15 +38,117 @@ G_DEFINE_TYPE (GisEndlessEulaPage, gis_endless_eula_page, GIS_TYPE_PAGE);
#define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
#define WID(name) OBJ(GtkWidget*,name)
+#define METRICS_PRIVACY_POLICY_URI "metrics-privacy-policy"
+
+static void
+sync_page_complete (GisEndlessEulaPage *page)
+{
+ GtkWidget *widget;
+ gboolean terms_agreed;
+
+ widget = WID ("terms-checkbutton");
+ terms_agreed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
+ gis_page_set_complete (GIS_PAGE (page), terms_agreed);
+}
+
+static void
+sync_metrics_active_state (GisEndlessEulaPage *page)
+{
+ GtkWidget *widget;
+ gboolean metrics_active;
+
+ widget = WID ("metrics-checkbutton");
+ metrics_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
+ /* TODO: forward the active state to the metrics daemon */
+}
+
+static GtkWidget *
+build_policy_view (void)
+{
+ GtkWidget *label;
+ PangoAttrList *attr_list;
+ PangoAttribute *attr;
+
+ label = gtk_label_new (_("Endless collects metrics on user behavior and actions.\n"
+ "All data sent is anonymous.\n"
+ "We use the data to improve the system."));
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ attr_list = pango_attr_list_new ();
+ attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
+ pango_attr_list_insert (attr_list, attr);
+
+ gtk_label_set_attributes (GTK_LABEL (label), attr_list);
+ pango_attr_list_unref (attr_list);
+
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+ gtk_widget_set_vexpand (label, TRUE);
+
+ return label;
+}
+
+static void
+show_metrics_privacy_policy (GisEndlessEulaPage *page)
+{
+ GtkWindow *toplevel;
+ GtkWidget *dialog, *view, *content_area;
+
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page)));
+ dialog = gtk_dialog_new_with_buttons (_("Privacy Policy"),
+ toplevel,
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT |
+ GTK_DIALOG_USE_HEADER_BAR,
+ NULL, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 400);
+
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (content_area), 16);
+
+ view = build_policy_view ();
+ gtk_container_add (GTK_CONTAINER (content_area), view);
+
+ gtk_widget_show_all (dialog);
+}
+
+static gboolean
+metrics_privacy_label_link_cb (GtkLabel *label,
+ gchar *uri,
+ GisEndlessEulaPage *page)
+{
+ if (g_strcmp0 (uri, METRICS_PRIVACY_POLICY_URI) == 0)
+ {
+ show_metrics_privacy_policy (page);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
gis_endless_eula_page_constructed (GObject *object)
{
GisEndlessEulaPage *page = GIS_ENDLESS_EULA_PAGE (object);
+ GtkWidget *widget;
G_OBJECT_CLASS (gis_endless_eula_page_parent_class)->constructed (object);
gtk_container_add (GTK_CONTAINER (page), WID ("endless-eula-page"));
gtk_widget_show (GTK_WIDGET (page));
+
+ widget = WID ("terms-checkbutton");
+ g_signal_connect_swapped (widget, "toggled",
+ G_CALLBACK (sync_page_complete), page);
+
+ widget = WID ("metrics-checkbutton");
+ g_signal_connect_swapped (widget, "toggled",
+ G_CALLBACK (sync_metrics_active_state), page);
+
+ widget = WID ("metrics-privacy-label");
+ g_signal_connect (widget, "activate-link",
+ G_CALLBACK (metrics_privacy_label_link_cb), page);
}
static void
diff --git a/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.ui
b/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.ui
index eee32eb..4182a8c 100644
--- a/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.ui
+++ b/gnome-initial-setup/pages/endless-eula/gis-endless-eula-page.ui
@@ -5,5 +5,125 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">end</property>
+ <property name="margin_left">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="metrics-checkbutton">
+ <property name="label" translatable="yes">Enable metrics collection.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="metrics-privacy-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><a href='metrics-privacy-policy'>Click
here</a> to see our privacy policy</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">baseline</property>
+ <property name="valign">start</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="label" translatable="yes">Third-party Software</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Endless uses third-party software to display Flash,
MP3 and other media. Some of this software is closed-source. The software is subject to the license terms
included with the software's documentation.</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">48</property>
+ <attributes>
+ <attribute name="scale" value="0.82999999999999996"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="terms-checkbutton">
+ <property name="label" translatable="yes">I agree to the license terms</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="valign">center</property>
+ <property name="margin_left">12</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]