[gnome-initial-setup] eula: Make the "Next" button say "Accept"



commit 6107c5bcf041b4751942410efecca493c2e1d780
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Oct 31 15:14:11 2013 -0400

    eula: Make the "Next" button say "Accept"

 gnome-initial-setup/gis-assistant.c              |   41 ++++++++++++++--------
 gnome-initial-setup/gis-assistant.ui             |   10 +++++-
 gnome-initial-setup/gis-page.c                   |   28 ++++++++++++++-
 gnome-initial-setup/gis-page.h                   |    2 +
 gnome-initial-setup/pages/eulas/gis-eula-page.ui |    1 +
 5 files changed, 65 insertions(+), 17 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index bcefde1..3314e94 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -48,9 +48,11 @@ static guint signals[LAST_SIGNAL];
 struct _GisAssistantPrivate
 {
   GtkWidget *forward;
+  GtkWidget *accept;
   GtkWidget *skip;
   GtkWidget *back;
   GtkWidget *cancel;
+
   GtkWidget *progress_indicator;
   GtkWidget *main_layout;
   GtkWidget *spinner;
@@ -222,30 +224,34 @@ update_navigation_buttons (GisAssistant *assistant)
     }
   else
     {
-      gboolean page_complete, page_skippable, is_first_page;
-
-      gtk_widget_show (priv->back);
-      gtk_widget_show (priv->forward);
+      gboolean is_first_page;
+      GtkWidget *forward_widget;
 
       is_first_page = (page_priv->link->prev == NULL);
       gtk_widget_set_visible (priv->back, !is_first_page);
 
-      page_complete = gis_page_get_complete (page);
-      page_skippable = gis_page_get_skippable (page);
+      gtk_widget_hide (priv->forward);
+      gtk_widget_hide (priv->accept);
+      gtk_widget_hide (priv->skip);
+
+      if (gis_page_get_needs_accept (page))
+        forward_widget = priv->accept;
+      else
+        forward_widget = priv->forward;
 
-      if (page_complete) {
-        gtk_widget_show (priv->forward);
+      if (gis_page_get_complete (page)) {
+        gtk_widget_show (forward_widget);
         gtk_widget_hide (priv->skip);
-        gtk_widget_set_sensitive (priv->forward, TRUE);
-        gtk_style_context_add_class (gtk_widget_get_style_context (priv->forward), "suggested-action");
-      } else if (page_skippable) {
-        gtk_widget_hide (priv->forward);
+        gtk_widget_set_sensitive (forward_widget, TRUE);
+        gtk_style_context_add_class (gtk_widget_get_style_context (forward_widget), "suggested-action");
+      } else if (gis_page_get_skippable (page)) {
+        gtk_widget_hide (forward_widget);
         gtk_widget_show (priv->skip);
       } else {
-        gtk_widget_show (priv->forward);
+        gtk_widget_show (forward_widget);
         gtk_widget_hide (priv->skip);
-        gtk_widget_set_sensitive (priv->forward, FALSE);
-        gtk_style_context_remove_class (gtk_widget_get_style_context (priv->forward), "suggested-action");
+        gtk_widget_set_sensitive (forward_widget, FALSE);
+        gtk_style_context_remove_class (gtk_widget_get_style_context (forward_widget), "suggested-action");
       }
     }
 }
@@ -411,6 +417,7 @@ gis_assistant_locale_changed (GisAssistant *assistant)
   GList *l;
 
   gtk_button_set_label (GTK_BUTTON (priv->forward), _("_Next"));
+  gtk_button_set_label (GTK_BUTTON (priv->accept), _("_Accept"));
   gtk_button_set_label (GTK_BUTTON (priv->skip), _("_Skip"));
   gtk_button_set_label (GTK_BUTTON (priv->back), _("_Previous"));
   gtk_button_set_label (GTK_BUTTON (priv->cancel), _("_Cancel"));
@@ -440,7 +447,9 @@ gis_assistant_init (GisAssistant *assistant)
                     G_CALLBACK (current_page_changed), assistant);
 
   g_signal_connect (priv->forward, "clicked", G_CALLBACK (go_forward), assistant);
+  g_signal_connect (priv->accept, "clicked", G_CALLBACK (go_forward), assistant);
   g_signal_connect (priv->skip, "clicked", G_CALLBACK (go_forward), assistant);
+
   g_signal_connect (priv->back, "clicked", G_CALLBACK (go_backward), assistant);
   g_signal_connect (priv->cancel, "clicked", G_CALLBACK (do_cancel), assistant);
 
@@ -476,9 +485,11 @@ gis_assistant_class_init (GisAssistantClass *klass)
   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 
"/org/gnome/initial-setup/gis-assistant.ui");
 
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, forward);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, accept);
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, skip);
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, back);
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, cancel);
+
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, progress_indicator);
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, main_layout);
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisAssistant, spinner);
diff --git a/gnome-initial-setup/gis-assistant.ui b/gnome-initial-setup/gis-assistant.ui
index d6b1f1e..4ecae2a 100644
--- a/gnome-initial-setup/gis-assistant.ui
+++ b/gnome-initial-setup/gis-assistant.ui
@@ -33,7 +33,15 @@
     </child>
     <child>
       <object class="GtkButton" id="forward">
-        <property name="visible">True</property>
+        <property name="use-underline">True</property>
+        <property name="can-default">True</property>
+      </object>
+      <packing>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton" id="accept">
         <property name="use-underline">True</property>
         <property name="can-default">True</property>
       </object>
diff --git a/gnome-initial-setup/gis-page.c b/gnome-initial-setup/gis-page.c
index ab2bedc..9643eaa 100644
--- a/gnome-initial-setup/gis-page.c
+++ b/gnome-initial-setup/gis-page.c
@@ -38,7 +38,8 @@ struct _GisPagePrivate
 
   guint complete : 1;
   guint skippable : 1;
-  guint padding : 6;
+  guint needs_accept : 1;
+  guint padding : 5;
 };
 typedef struct _GisPagePrivate GisPagePrivate;
 
@@ -51,6 +52,7 @@ enum
   PROP_TITLE,
   PROP_COMPLETE,
   PROP_SKIPPABLE,
+  PROP_NEEDS_ACCEPT,
   PROP_APPLYING,
   PROP_LAST,
 };
@@ -79,6 +81,9 @@ gis_page_get_property (GObject    *object,
     case PROP_SKIPPABLE:
       g_value_set_boolean (value, priv->skippable);
       break;
+    case PROP_NEEDS_ACCEPT:
+      g_value_set_boolean (value, priv->needs_accept);
+      break;
     case PROP_APPLYING:
       g_value_set_boolean (value, gis_page_get_applying (page));
       break;
@@ -107,6 +112,9 @@ gis_page_set_property (GObject      *object,
     case PROP_SKIPPABLE:
       priv->skippable = g_value_get_boolean (value);
       break;
+    case PROP_NEEDS_ACCEPT:
+      priv->needs_accept = g_value_get_boolean (value);
+      break;
     case PROP_COMPLETE:
       priv->complete = g_value_get_boolean (value);
       break;
@@ -186,6 +194,9 @@ gis_page_class_init (GisPageClass *klass)
   obj_props[PROP_SKIPPABLE] =
     g_param_spec_boolean ("skippable", "", "", FALSE,
                           G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
+  obj_props[PROP_NEEDS_ACCEPT] =
+    g_param_spec_boolean ("needs-accept", "", "", FALSE,
+                          G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
   obj_props[PROP_APPLYING] =
     g_param_spec_boolean ("applying", "", "", FALSE,
                           G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
@@ -247,6 +258,21 @@ gis_page_set_skippable (GisPage *page, gboolean skippable)
   g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_SKIPPABLE]);
 }
 
+gboolean
+gis_page_get_needs_accept (GisPage *page)
+{
+  GisPagePrivate *priv = gis_page_get_instance_private (page);
+  return priv->needs_accept;
+}
+
+void
+gis_page_set_needs_accept (GisPage *page, gboolean needs_accept)
+{
+  GisPagePrivate *priv = gis_page_get_instance_private (page);
+  priv->needs_accept = needs_accept;
+  g_object_notify_by_pspec (G_OBJECT (page), obj_props[PROP_NEEDS_ACCEPT]);
+}
+
 void
 gis_page_locale_changed (GisPage *page)
 {
diff --git a/gnome-initial-setup/gis-page.h b/gnome-initial-setup/gis-page.h
index 77cf953..4117d94 100644
--- a/gnome-initial-setup/gis-page.h
+++ b/gnome-initial-setup/gis-page.h
@@ -72,6 +72,8 @@ gboolean     gis_page_get_complete (GisPage *page);
 void         gis_page_set_complete (GisPage *page, gboolean complete);
 gboolean     gis_page_get_skippable (GisPage *page);
 void         gis_page_set_skippable (GisPage *page, gboolean skippable);
+gboolean     gis_page_get_needs_accept (GisPage *page);
+void         gis_page_set_needs_accept (GisPage *page, gboolean needs_accept);
 GtkWidget *  gis_page_get_action_widget (GisPage *page);
 void         gis_page_locale_changed (GisPage *page);
 void         gis_page_apply_begin (GisPage *page, GisPageApplyCallback callback, gpointer user_data);
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-page.ui 
b/gnome-initial-setup/pages/eulas/gis-eula-page.ui
index 39f5800..73665c0 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-page.ui
+++ b/gnome-initial-setup/pages/eulas/gis-eula-page.ui
@@ -2,6 +2,7 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <template class="GisEulaPage" parent="GisPage">
+    <property name="needs-accept">True</property>
     <child>
       <object class="GtkBox" id="box">
         <property name="visible">True</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]